#StackBounty: #javascript #html #jquery #plugins Tool tip in html

Bounty: 400

I have a div that needs to be identified using a line and box(which will contain a message) like in the below mockup image.2 and 3(Line and a rectangular box) are fixed to each other and draggable and 1(Line) can be stretched to any direction. I have created the box but I am not able to figure out how can I attach a line to it. Here is what I have tried.

JSFIDDLE

js

const $b1 = $("#box1");
const $b2 = $("#box2");
const $line = $("#line");

const coordinates = function() {
debugger;
  const x1 = $b1.offset().left;
  const y1 = $b1.offset().top + $b1.height()/2;
  const x2 = $b2.offset().left + $b1.width()/2;
  const y2 = $b2.offset().top + $b1.height()/2;

  moveLine(x1, y1, x2, y2);  
}

coordinates();

function moveLine(x1, y1, x2, y2) {
    var length = Math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
    var angle = Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
    var transform = 'rotate(' + angle + 'deg)';

    offsetX = (x1 > x2) ? x2 : x1;
    offsetY = (y1 > y2) ? y2 : y1;
    
    $line.css({
        'position': 'absolute',
        '-webkit-transform': transform,
        '-moz-transform': transform,
        'transform': transform
      })
      .width(length)
      .offset({
        left: offsetX,
        top: offsetY
      });
}

$('#box1').draggable({
  drag: coordinates
});

Html

<div class="box" id="box1">10%</div>
<p id="box2">www.google.com</p>

<div class="line" id="line"></div>

css

.box {
  border: 1px solid black;
  background-color: #ffffff;
  width: 100px;
  height: 40px;
  position: absolute;
}

#line1 {
  top: 100px;
  left: 50px;
  /*transform: rotate(222deg);
    -webkit-transform: rotate(222deg);
    -ms-transform: rotate(222deg);*/
}

.line {
  width: 1px;
  height: 1px;
  background-color: black;
  position: absolute;
  z-index: -1; /* put line behind the boxes */
}


#box1 {
  top: 150px;
  left: 150px;
}

#box2 {
  top: 200px;
  left: 200px;
  position:relative;
}

enter image description here


Get this bounty!!!

#StackBounty: #20.04 #python3 #gedit #plugins How do I fix "The plugin "External Tools" could not be loaded. An error oc…

Bounty: 50

I’m using GEdit version 3.36.2 pre-installed with Ubuntu 20.04.1.
I wanted to enable the External Tools plugin of GEdit, but I’m unable to do so.

When I click on the External Tools option, I get ⛔ symbol.

Gedit preferences

When I close GEdit and reopen it, the option is turned off.

Gedit preferences

If I enable it, I’ll again get the same ⛔ symbol.

How do I fix this issue?


Edit 1:
gir1.2-gtksource-3.0 was not installed when I asked this question. After jokerdino’s suggestion in the Ask Ubuntu General Room, I installed gir1.2-gtksource-3.0 using this command: sudo apt install gir1.2-gtksource-3.0.

I noticed an error message after installing gir1.2-gtksource-3.0.

Error message in gedit

The plugin "External Tools" could not be loaded
An error occured: Plugin loader "python 3" was not found

I am not sure if I could see this error message before installing gir1.2-gtksource-3.0. Maybe I didn’t place the mouse pointer on the symbol (for few seconds) the first time when I noticed the symbol or maybe it could be some other reason. I don’t know.

jokerdino suggested me to open gedit from terminal and check if I got any specific error while turning on External Tools. I did get an error in the terminal.

** (gedit:14693): WARNING **: 20:21:59.976: Error initializing Python Plugin Loader: PyGObject initialization failed
ImportError: could not import gobject (error was: ModuleNotFoundError("No module named 'gi'"))

** (gedit:14693): WARNING **: 20:21:59.976: Please check the installation of all the Python related packages required by libpeas and try again

(gedit:14693): libpeas-WARNING **: 20:21:59.976: Loader 'python3' is not a valid PeasPluginLoader instance

I guess Python 3.8.2 was pre-installed with my Ubuntu installation. I wanted to upgrade to Python 3.8.3. So I followed the instructions mentioned in this website Install Python 3.8.3 in Ubuntu 20.04 LTS – TechPiezo.
At the end of the article, two suggestions were given. First is to replace (or overwrite) already installed version 3.8.2 of Python; second is to install Python v3.8.3 alongside the Python v3.8.2. I followed the first option.


Get this bounty!!!

#StackBounty: #20.04 #python3 #gedit #plugins Unable to enable External Tools in gedit

Bounty: 50

gedit version: 3.36.2

About Gedit

OS Details:

OS details

I’m using the gedit which was pre-installed with Ubuntu.

I want to enable the External Tools plugin of gedit, but I’m unable to do so.

When I click on the External Tools option, I get a symbol.

Gedit preferences

When I close gedit and reopen it, the option is turned off.

Gedit preferences

If I enable it, I’ll again get the same red symbol.

How to fix this issue?


Edit 1:
gir1.2-gtksource-3.0 was not installed when I asked this question. After jokerdino’s suggestion in the Ask Ubuntu General Room, I installed gir1.2-gtksource-3.0 using this command: sudo apt install gir1.2-gtksource-3.0.

I noticed an error message after installing gir1.2-gtksource-3.0.

Error message in gedit

The plugin "External Tools" could not be loaded
An error occured: Plugin loader "python 3" was not found

I am not sure if I could see this error message before installing gir1.2-gtksource-3.0. Maybe I didn’t place the mouse pointer on the symbol (for few seconds) the first time when I noticed the symbol or maybe it could be some other reason. I don’t know.

jokerdino suggested me to open gedit from terminal and check if I got any specific error while turning on External Tools. I did get an error in the terminal.

** (gedit:14693): WARNING **: 20:21:59.976: Error initializing Python Plugin Loader: PyGObject initialization failed
ImportError: could not import gobject (error was: ModuleNotFoundError("No module named 'gi'"))

** (gedit:14693): WARNING **: 20:21:59.976: Please check the installation of all the Python related packages required by libpeas and try again

(gedit:14693): libpeas-WARNING **: 20:21:59.976: Loader 'python3' is not a valid PeasPluginLoader instance

I will provide some details about my Python. I guess Python 3.8.2 was pre-installed with my Ubuntu installation. I wanted to upgrade to Python 3.8.3. So I followed the instructions mentioned in this website: https://techpiezo.com/python/install-python-3-8-3-in-ubuntu-20-04-lts/.
At the end of the article, two suggestions were given. One, to replace (or overwrite) already installed version 3.8.2 of Python; two, to install Python v3.8.3 alongside the Python v3.8.2. I did the first option.


Get this bounty!!!

#StackBounty: #20.04 #gedit #plugins Unable to enable External Tools in gedit

Bounty: 50

gedit version: 3.36.2

About Gedit

OS Details:

OS details

I’m using the gedit which was pre-installed with Ubuntu.

I want to enable the External Tools plugin of gedit, but I’m unable to do so.

When I click on the External Tools option, I get a symbol.

Gedit preferences

When I close gedit and reopen it, the option is turned off.

Gedit preferences

If I enable it, I’ll again get the same red symbol.

How to fix this issue?


Get this bounty!!!

#StackBounty: #ubuntu #plugins #jmeter #nagios How to properly configure jmeter plugin in nagios so it shows OK status in case if every…

Bounty: 200

I have installed and configured nagios on my server (records from history used):

 1875  wget https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz
 1876  tar xzf nagios-4.4.5.tar.gz 
 1877  cd nagioscore-nagios-4.4.5/
 1881  sudo usermod -a -G nagios www-data
 1889  sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
 1892  sudo apt install nagios-plugins nagios-npre-plugin

copied/replaced some files from my other server with working configuration (including jmeter.pl plugin):

 2010  sudo unzip nagios.zip -d ./arc/
 2011  sudo cp -r arc/usr/local/nagios/etc/objects/hosts.cfg /usr/local/nagios/etc/objects/
 2012  sudo cp -r arc/usr/local/nagios/etc/objects/co* /usr/local/nagios/etc/objects/
 2013  sudo cp -r arc/usr/local/nagios/etc/nagios.cfg /usr/local/nagios/etc/
 2014  sudo cp -r arc/usr/local/nagios/etc/resource.cfg /usr/local/nagios/etc/
 2015  sudo cp arc/usr/local/nagios/libexec/jmeter.pl /usr/local/nagios/libexec/
 2016  sudo chown nagios:nagios /usr/local/nagios/libexec/jmeter.pl 
 2018  sudo cp arc/usr/local/nagios/libexec/*.jmx /usr/local/nagios/libexec/
 2019  sudo chown nagios:nagios /usr/local/nagios/libexec/*.jmx
 2020  sudo chown nagios:nagios /usr/local/nagios/etc/objects/hosts.cfg
 2021  sudo cp -r arc/usr/local/nagios/etc/objects/localhost.cfg /usr/local/nagios/etc/objects/

and made default plugins available for nagios using symlinking (it could be configured properly in nagios settings, but I would try it the next time)

 2027  sudo ln -s /usr/lib/nagios/plugins/* /usr/local/nagios/libexec/

Changing only jmeter paths location paths in commands.cfg file

2036  sudo sed -i 's/home/user/.local/share/usr/bin/g' /usr/local/nagios/etc/objects/commands.cfg

Nagios starts without issues.
jmeter tests seems are being running without issues also:

cat /usr/local/nagios/libexec/my_project.1593701411.359482.jtl
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1593701413376,1143,My Project. Login,200,OK,my_project.com 1-1,text,true,,561,637,1,1,https://my_project.com/api/user/login,1140,0,942
1593701414524,169,My Project. Main page,200,OK,my_project.com 1-1,text,true,,12628,415,1,1,https://my_project.com/,167,0,0
1593701414694,1949,My Project. Search request,200,OK,my_project.com 1-1,text,true,,8450,559,1,1,https://my_project.com/api/query,1949,0,0

Later I’ve downloaded jmeter 4.3, put it into /usr/local/nagios/share folder, downloaded plugins manager for it and used it in nagios. It did not help, but I’ve left it as it is. Perl script executed directly in terminal:
perl /usr/local/nagios/libexec/jmeter.pl -j="/usr/local/nagios/share/jmeter" -p="/usr/local/nagios/libexec/my_project.jmx" outputs:

OK :  | sum_time=3.14

But nagios displays on the Services tab the next:

CRITICAL: 'java -server -jar /usr/share/jmeter/bin/ApacheJMeter.jar --nongui --propfile /usr/share/jmeter/bin/jmeter.properties --testfile /usr/local/nagios/libexec/my_project.jmx --logfile /usr/local/nagios/libexec/my_project.1593702311.382657.jtl' exit with wait status of 0 Errors Jul 02, 2020 3:05:12 PM java.util.prefs.FileSystemPreferences$1 run

Command in /usr/local/nagios/etc/objects/commands.cfg:

define command {
    command_name    check_jmeter_my_project
    command_line    perl /usr/local/nagios/libexec/jmeter.pl -j="/usr/share/jmeter" -p="/usr/local/nagios/libexec/my_project.jmx"
}

Definitions examples in /usr/local/nagios/etc/objects/hosts.cfg:

define hostgroup {
    hostgroup_name  linux-servers
    alias           Linux Servers
    members         my_project.com,my_project2.com,my_project3.com,my_project4.com
}


define host {
    use                     linux-server
    host_name               my_project.com
    alias                   my_project.com
    max_check_attempts      10
}

define service {
    use                     local-service
    host_name               my_project.com
    service_description     My Project production jmeter test
    check_command           check_jmeter_my_project
}

How could I resolve this issue?

enter image description here

Update (nagios reinstalled):

  • I’ve downloaded nagios 4.4.6 and installed it (following instruction for 20.04)
  • Downloaded nagios plugins 2.3.3 and installed them
  • Downloaded newer version of jmeter.pl and put it into /usr/local/nagios/libexec/
  • Put *.jmx jmeter test plans into libexec also
  • Put hosts.cfg into /usr/local/nagios/etc/objects folder
  • Added the cfg_file=/usr/local/nagios/etc/objects/hosts.cfg line to /usr/local/nagios/etc/nagios.cfg file
  • Put jmeter 5.3 folder to /usr/local/nagios/share/ folder
  • Changed default java version to 11: sudo update-alternatives --config java
  • Added to default /usr/local/nagios/etc/objects/commands.cfg file the next command:
      define command {
          command_name    check_jmeter
          command_line    /usr/bin/perl /usr/local/nagios/libexec/jmeter.pl -H $HOSTADDRESS$ -j=$ARG1$ -p=$ARG2$ -w $ARG3$ -c $ARG4$
      }
    
  • Changed hosts definitions to:
      define service {
          use                     local-service
          host_name               my_project.com
          service_description     My Project production jmeter test
          check_command           check_jmeter!/usr/local/nagios/share/jmeter!/usr/local/nagios/libexec/my_project.jmx!5!10!30
      }
    

All these action have not resolved the issue. It looks like before:

CRITICAL: 'java -server -jar /usr/local/nagios/share/jmeter/bin/ApacheJMeter.jar --nongui --propfile /usr/local/nagios/share/jmeter/bin/jmeter.properties --testfile /usr/local/nagios/libexec/my_project.jmx --logfile /tmp/1593780023.1931052.jtl' exit with wait status of 0 Errors Jul 03, 2020 3:40:24 PM java.util.prefs.FileSystemPreferences$1 run

Configuration

Nagios 4.4.5, jmeter 5.2.1, perl 5.30.0 and

java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

for both servers.

The first server with working configuration is a fresh installed Lubuntu 20.04.

uname -a
Linux ubuntu 5.4.0-39-generic #43-Ubuntu SMP Fri Jun 19 10:28:31 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

The second server is Ubuntu upgraded from 19.04 to 19.10, then to 20.04

uname -a
Linux usu 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Update

The issue have been reproduced for a fresh installed and upgraded Lubuntu 20.04 with 5.4.0-42-generic kernel, Nagios 4.4.6, Java 1.8.0_265, Jmeter 5.3.

enter image description here

When run this plugin manually:

user@ubuntu:~$ /usr/bin/perl /usr/local/nagios/libexec/jmeter.pl -j=/usr/local/nagios/share/jmeter -p=/usr/local/nagios/libexec/test.jmx -t 80 -w 90 -c 100
OK :  | sum_time=26.91
user@ubuntu:~$ echo $#
0

Once I’ve got the same result as on the screenshot above by running the same using sudo, but could not reproduce it again:

$ sudo /usr/bin/perl /usr/local/nagios/libexec/jmeter.pl -j=/usr/local/nagios/share/jmeter -p=/usr/local/nagios/libexec/test.jmx -t 80 -w 90 -c 100
[sudo] password for user: 
CRITICAL: 'java -server  -jar /usr/local/nagios/share/jmeter/bin/ApacheJMeter.jar --nongui --propfile /usr/local/nagios/share/jmeter/bin/jmeter.properties --testfile /usr/local/nagios/libexec/test.jmx --logfile /tmp/1597861570.41537.jtl' exit with wait status of 0 Errors Aug 19, 2020 9:26:21 PM java.util.prefs.FileSystemPreferences$1 run

INFO: Created user preferences directory.


Get this bounty!!!

#StackBounty: #plugins #plugin-development #customization #javascript #jquery Override a function on editor.js file on Elementor

Bounty: 50

I’m working on a Elementor Project, I need urgent help to add few devices here. Since, ‘editor.min.js’ is on Elementor core file, but I need to add/Override few lines on this file.

What I’ve doing –

    $wpse_devices = array(
       'new_device'  =>'.addDevice('WPSE', i.650)'
    );
    wp_localize_script( 'elementor-editor', 'wpse_editor', $wpse_devices );

Current Version is /*! elementor - v2.9.14 - 21-07-2020 */

On line#9738

  initStylesheet: function initStylesheet() {
    var breakpoints = elementorFrontend.config.breakpoints;
    this.stylesheet = new Stylesheet();
    this.stylesheet.addDevice('mobile', 0).addDevice('tablet', breakpoints.md).addDevice('desktop', breakpoints.lg);
  }

I need it to Override this method on my project. It should be like –

  initStylesheet: function initStylesheet() {
    var breakpoints = elementorFrontend.config.breakpoints;
    this.stylesheet = new Stylesheet();
    this.stylesheet
       .addDevice('mobile', 0)
       .addDevice('tablet', breakpoints.md)
       .addDevice('desktop', breakpoints.lg)
       + wpse_editor.new_device;
  }

I’ve tried to find out many ways, but no luck. This file built with Webpack and Reactjs.
Any help will save me.


Get this bounty!!!

#StackBounty: #plugins #ajax #gallery Theme is Causing Ajax Conflicts for a plugin I cant identify it

Bounty: 100

This is a bit of a odd one, It is plugin related but sadly 1 month without a response from the Owner of the Plugin im turning to the community

The Problem is that I have this plugin "Visual Portfolio" Which uses Ajax to filter and load Images for a Gallery

Now After hours of fiddling,removing jq , removing plugins trying to pinpoint the issue, I’ve kinda figured out the plugin’s ajax stops working all together whenever I call my footer in my Theme

So whenever I say It breaks even if I remove every single line of Code from the Footer except for <?php wp_footer(); ?>

Im at a complete loss ive removed any and all jq from the site all plugins and still, but for some reason It works on the Twenty-Twenty Theme so I know its a Conflict,

Do you guys maybe have some advice in regards to General Debugging for this kind of thing Before everyone jumps into arms and says this is not plugin specific support Im asking for a General Thing of how would you go about trying to resolve this your self, Please let me know of any code you might need.

Small note the Gallery Is Populated from a Post type and the featured images of that Post type.

Ill add my Footer, And a page where the gallery appears,

<?php wp_footer(); ?>
<script>
const backToTopButton = document.querySelector("#back-to-top-btn");

window.addEventListener("scroll", scrollFunction);

function scrollFunction() {
  if (window.pageYOffset > 300) { // Show backToTopButton
    if(!backToTopButton.classList.contains("btnEntrance")) {
      backToTopButton.classList.remove("btnExit");
      backToTopButton.classList.add("btnEntrance");
      backToTopButton.style.display = "block";
    }
  }
  else { // Hide backToTopButton
    if(backToTopButton.classList.contains("btnEntrance")) {
      backToTopButton.classList.remove("btnEntrance");
      backToTopButton.classList.add("btnExit");
      setTimeout(function() {
        backToTopButton.style.display = "none";
      }, 250);
    }
  }
}

backToTopButton.addEventListener("click", smoothScrollBackToTop);

// function backToTop() {
//   window.scrollTo(0, 0);
// }

function smoothScrollBackToTop() {
  const targetPosition = 0;
  const startPosition = window.pageYOffset;
  const distance = targetPosition - startPosition;
  const duration = 750;
  let start = null;
  
  window.requestAnimationFrame(step);

  function step(timestamp) {
    if (!start) start = timestamp;
    const progress = timestamp - start;
    window.scrollTo(0, easeInOutCubic(progress, startPosition, distance, duration));
    if (progress < duration) window.requestAnimationFrame(step);
  }
}

function easeInOutCubic(t, b, c, d) {
    t /= d/2;
    if (t < 1) return c/2*t*t*t + b;
    t -= 2;
    return c/2*(t*t*t + 2) + b;
};    
</script>
<footer>
    <button id="back-to-top-btn"><i class="fas fa-angle-double-up"></i></button>
    <section class="footer ">
        <div class="container ta-c">
        <div class="footer-top">
            <div class="row img-row">
                <div class="col-md-3 col-6">
                    <img class="footer-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/footer-img-1.png">
                </div>
                <div class="col-md-3 col-6">
                    <img class="footer-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/footer-img-2.png">
                </div>
                <div class="col-md-3 col-6">
                    <img class="footer-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/footer-img-3.png">
                </div>
                <div class="col-md-3 col-6">
                    <img class="footer-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/footer-img-4.png">
                </div>
            </div>
            <div class="row" style="width: 100%">
                <div class="col-md-3 footer-block">

                    <h5>NEW BUSINESS INQUIRIES</h5>
                    <h2 ></h2>
                    <p class="railway-simple mg-remove">RESEARCH & MARKETING MANAGER</p>
                    <a class="footer-mail" href="mailto:"></a>
                </div>
                <div class="col-md-3 footer-block">

                    <h5>CALL US</h5>
                    <a  href="tel:">(</a>
                </div>
                <div class="col-md-3 footer-block">

                    <h5>POP IN FOR A CHAT</h5>
                    <a  href=""></a>
                    <p class="railway-simple" ></p>
                </div>
                <div class="col-md-3 footer-block">

                    <h5>FOLLOW US</h5>
                   <a style="margin: 10px;" href=""> <i class=" fab fa-facebook-f"></i></a>
                    <a href=""><i class="fab fa-linkedin-in"></i></a>
                </div>
            </div>
        </div>
            <div class="parent-footer">
                <h2>SITEMAP</h2>
            </div>

        <div class="footer-sitemap row">

            <div class="col-md-2">
                <h3>We are.</h3>
                <ul>
                    <li><a href="<?php echo get_home_url(); ?>/lionremaster">Home</a></li>
                    <li><a href="<?php echo get_home_url(); ?>/about/">We are</a></li>
                    <li><a href="<?php echo get_home_url(); ?>/about">About</a></li>
                    <li><a href="<?php echo get_home_url(); ?>/theteam">Meet the team</a></li>
                </ul>
            </div>
            <div class="col-md-2">
                <h3>We do.</h3>
                <ul>
                    <li><a href="<?php echo get_home_url(); ?>/wedo/#services">Services</a></li>
                    <li><a  href="<?php echo get_home_url(); ?>/partners">Partners</a></li>

                    <li><a>Freebies</a></li>
                </ul>
            </div>
            <div class="col-md-2">
                <h3>Why us.</h3>
                <ul>
                    <li><a href="<?php echo get_home_url(); ?>/whyus">Why us</a></li>
                </ul>
            </div>
            <div class="col-md-3">
                <h3>Who we work with.</h3>
                <ul>
                    <li><a href="<?php echo get_home_url(); ?>/brandstories">Brand Stories</a></li>
                    <li><a href="<?php echo get_home_url(); ?>/gallery">Gallery</a></li>
                    <li><a>Case Studies</a></li>
                    <li><a href="<?php echo get_home_url(); ?>/news">Industry News</a></li>
                </ul>
            </div>
            <div class="col-md-2">
                <h3>Get in touch.</h3>
                <ul>
                    <li><a href="<?php echo get_home_url(); ?>/getintouch">Contact us</a></li>
                </ul>
            </div>

         </div>
        </div>
    </section>
</footer>
<?php
get_header();
?>
<section class="brand-main">
    <div class="container">
        <div class="brand-header">
            <img class="line-img" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-10.png">
            <h4 style="letter-spacing: 2px;" class="railway-regular mg-top-s">BRAND STORIES</h4>
            <h1 class="railway-extra ">A PRIDE OF
                BRAND STORIES
                TO TALK ABOUT</h1>
            <img class="line-img mg-top-s" src="<?php echo home_url();?>/wp-content/uploads/2020/04/Asset-10.png">
        </div>
        <div class="brand mg-top-m">
            <?php
            echo do_shortcode('[visual_portfolio id="191" class=""]');
            ?>

            </div>
    </div>
</section>
<?php
get_footer();
?>


Also the jq file for my site:

function openTab(evt, cityName) {
    let buttonIndex = -1;
    const $clickedButton = $(evt.target); //Using Jquery to get the button which was clicked
    const tabcontent = document.getElementsByClassName("tabcontent");

    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }

    if($clickedButton.hasClass('tablinks')){
        $('.tablinks').each(function(i, el){
            if($(el).is($clickedButton)){
                buttonIndex = i;
                return false; //break from the each now that we have the button index
            }
        });
    } else {
        $('.tablinks-title').each(function(i, el){
            if($(el).is($clickedButton)){
                buttonIndex = i;
                return false; //break from the each now that we have the button index
            }
        });
    }

    //Remove active class from buttons before adding to newly selected
    $('.tablinks').removeClass('active');
    $('.tablinks-title').removeClass('active');

    //Add the active class to the corresponding buttons at the clicked index for both
    //Number and title
    $($('.tablinks')[buttonIndex]).addClass('active');
    $($('.tablinks-title')[buttonIndex]).addClass('active');

    document.getElementById(cityName).style.display = "block";
  

}
  document.getElementById("defaultOpentitle").click();
    document.getElementById("defaultOpen").click();

filterSelection("all")
function filterSelection(c) {
    var x, i;
    x = document.getElementsByClassName("column");
    if (c == "all") c = "";
    for (i = 0; i < x.length; i++) {
        w3RemoveClass(x[i], "show");
        if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
    }
}

function w3AddClass(element, name) {
    var i, arr1, arr2;
    arr1 = element.className.split(" ");
    arr2 = name.split(" ");
    for (i = 0; i < arr2.length; i++) {
        if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];}
    }
}

function w3RemoveClass(element, name) {
    var i, arr1, arr2;
    arr1 = element.className.split(" ");
    arr2 = name.split(" ");
    for (i = 0; i < arr2.length; i++) {
        while (arr1.indexOf(arr2[i]) > -1) {
            arr1.splice(arr1.indexOf(arr2[i]), 1);
        }
    }
    element.className = arr1.join(" ");
}


// Add active class to the current button (highlight it)
var btnContainer = document.getElementById("myBtnContainer");
var btns = btnContainer.getElementsByClassName("btnz");
for (var i = 0; i < btns.length; i++) {
    btns[i].addEventListener("click", function(){
        var current = document.getElementsByClassName("active");
        current[0].className = current[0].className.replace(" active", "");
        this.className += " active";
    });
}







Adding on note’s

Im going to provide a site link you can have a look at the Galleries and you’ll see theres no functionality in relation to my ajax Im at the point where im willing to prove complete copies of the site just to get some assistance, I have 2 sites now that are using this plugin they share the same theme template theres a conflict thats neglecting all my ajax and I just dont know what it is anymore

Please let me know if there are any details you’d need

http://azipit.co.za/lionremaster/

My Functions php on my new site just for an example so you can see how little im using and theres still a conflict

<?php 

function wpt_theme_styles() {
    
    wp_enqueue_style( 'fontawesome_css', 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' );
    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css' );
    wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/jquery-ui.min.css' );

}
add_action( 'wp_enqueue_scripts', 'wpt_theme_styles' );

function my_scripts() {
    wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '', false );
    wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', false );
    wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/script.js', array('jquery'), '', false );  
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );

Heres a Screenshot of the new Site’s Structure this is on local host ILL post a image of the Site tech "In qeustion" as-well
enter image description here

enter image description here

I have plugins checking for errors but there are none, So I dont know what to post in that regard

Found one warning in logs now:

Warning: session_start(): Cannot start session when headers already sent in /home/azipitfy/public_html/lionremaster/wp-content/plugins/visual-portfolio/classes/class-get-portfolio.php on line 25

Here is a Zipped file with a local copy of the theme template I kinda use
and the Logins for them are:
U:Roy
P:Test

The Google Drive link

The only difference here beyond my other site would be extra pages and css so this would give a great example of the issue im having


Get this bounty!!!

#StackBounty: #plugins What's a reliable way to depend on another plugin?

Bounty: 300

Currently, the way I do it is, on the plugins_loaded hook, I let the world know that my plugin has loaded:

add_action( 'plugins_loaded', function() {
    do_action( 'my_plugin_has_loaded' );
}, 10 );

And so, others can depend/only run when my_plugin_has_loaded fires, however, I see a lot of hooks plugin_loaded (5.1.0) and even some plugins firing their init before plugins_loaded. Is there a better way to make a plugin wait for another?

The problem I see with this approach is that I launch my own init on plugins_loaded, however, I also see a silver lining – plugins are meant to be done loading here, so, if there’d be any type of logic like this, it’d be here.


Issue #1 – Using class_exists:

  1. I can’t force naming conventions as I would do for actions, such as always looking/hooking for plugin-$name%:init to ensure consistency through actions. If I know a plugin’s name, then I can very easily predict it’s init point so that I can run after, but if I don’t, I have to know what class is its main controller, which leads me to the next point –
  2. If I rely on this way of checking, I am merely looking for the existence of a class, which, at best, lets me know a plugin is activated, but not if the plugin has finished its setup. With an action I can arbitrarily decide when a plugin has finished loading and initializing all it needs such that dependants can run.

  3. Continuing from (2), I am now forcing myself to write plugins in such a way that I’d always need a god-mode-controller class that runs all its stuff on __construct. People who will do class_exists( 'MyClassFromPluginIWannaDependOn' )will also inherently assume that I run everything on __construct, however, my plugin my have errors in initializing itself, but, because it’s all run on __cosntruct, I can’t debug that.

Issue #2 – Using TGMPA:

  1. Assume plugin A dependend on plugin B. If the user disables B, then A will throw errors. Sure, I can handle them, but that’s exactly the point of the question, really – reverse this point I just said and you reach my problem: ensuring dependency while handling each case in which you interact with plugins. I need this to be completely off user-land territory.


Get this bounty!!!

#StackBounty: #plugins What's a reliable way to depend on another plugin?

Bounty: 300

Currently, the way I do it is, on the plugins_loaded hook, I let the world know that my plugin has loaded:

add_action( 'plugins_loaded', function() {
    do_action( 'my_plugin_has_loaded' );
}, 10 );

And so, others can depend/only run when my_plugin_has_loaded fires, however, I see a lot of hooks plugin_loaded (5.1.0) and even some plugins firing their init before plugins_loaded. Is there a better way to make a plugin wait for another?

The problem I see with this approach is that I launch my own init on plugins_loaded, however, I also see a silver lining – plugins are meant to be done loading here, so, if there’d be any type of logic like this, it’d be here.


Issue #1 – Using class_exists:

  1. I can’t force naming conventions as I would do for actions, such as always looking/hooking for plugin-$name%:init to ensure consistency through actions. If I know a plugin’s name, then I can very easily predict it’s init point so that I can run after, but if I don’t, I have to know what class is its main controller, which leads me to the next point –
  2. If I rely on this way of checking, I am merely looking for the existence of a class, which, at best, lets me know a plugin is activated, but not if the plugin has finished its setup. With an action I can arbitrarily decide when a plugin has finished loading and initializing all it needs such that dependants can run.

  3. Continuing from (2), I am now forcing myself to write plugins in such a way that I’d always need a god-mode-controller class that runs all its stuff on __construct. People who will do class_exists( 'MyClassFromPluginIWannaDependOn' )will also inherently assume that I run everything on __construct, however, my plugin my have errors in initializing itself, but, because it’s all run on __cosntruct, I can’t debug that.

Issue #2 – Using TGMPA:

  1. Assume plugin A dependend on plugin B. If the user disables B, then A will throw errors. Sure, I can handle them, but that’s exactly the point of the question, really – reverse this point I just said and you reach my problem: ensuring dependency while handling each case in which you interact with plugins. I need this to be completely off user-land territory.


Get this bounty!!!