Viewing 4 replies - 1 through 4 (of 4 total)
  • I’d be interested in this option as well please.

    Would love this too – its the only thing that puts me off the plugin; opening new windows.

    Other than that, I love it!

    You can install this yourself. Here’s how:

    Add this code to your header.php

    <script type="text/javascript">
    	//initialize the 3 popup css class names - create more if needed
    	var matchClass=['popup1','popup2','popup3'];
    	//Set your 3 basic sizes and other options for the class names above - create more if needed
    	var popup1 = 'width=600,height=270,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=20,top=20';
    	var popup2 = 'width=600,height=400,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=20,top=20';
    	var popup3 = 'width=600,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=20,top=20';
    
    	//The pop-up function
    	function tfpop(){
    			var x = 0;
    			var popClass;
    			//Cycle through the class names
    			while(x < matchClass.length){
    					popClass = "'."+matchClass[x]+"'";
    					//Attach the clicks to the popup classes
    					jQuery(eval(popClass)).click(function() {
    							//Get the destination URL and the class popup specs
    							var popurl = jQuery(this).attr('href');
    							var popupSpecs = jQuery(this).attr('class');
    							//Create a "unique" name for the window using a random number
    							var popupName = Math.floor(Math.random()*10000001);
    							//Opens the pop-up window according to the specified specs
    							newwindow=window.open(popurl,popupName,eval(popupSpecs));
    							return false;
    					});
    			x++;
    			}
    	}
    
    	//Wait until the page loads to call the function
    	jQuery(function() {
    		tfpop();
    	});
    </script>

    Note, you might want to change the jQuery variable to whatever you use. I usually use jQuery as that works better for a no conflict.

    Now you can go into the simple-share-buttons-adder.php to add the different classes. I used popup1 for twitter, popup 2 for facebook, and popup3 for linkedin. You can adjust the sizing as needed.

    Just go to where they call the different share link $htmlShareButtons and add class="popup1"

    For example, it should look like this for the twitter share

    $htmlShareButtons .= '<a id="ssba_twitter_share" class="popup1" href="https://twitter.com/share?url=' . $urlCurrentPage . '&text=' . $twitterShareText . '" ' . ($arrSettings['ssba_share_new_window'] == 'Y' ? 'target="_blank"' : NULL) . '>';

    You can see how I added class="popup1" to the a href code. Do that for each share button that you want a popup for.

    We have to hard code this, but what gonna happened on next plugin’s update. We cant update the code all the time. I guess its better to provide hooks for functions.php.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Enable JS Popup’ is closed to new replies.