Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    59
    Thanks
    1
    Thanked 0 Times in 0 Posts

    need some help of javascript code

    hi i want to create a popup code for my user he gert this code paste in his site and when open his site show popup. i use jquery popcode with my php code

    this is js-popunder code from jquery
    Code:
    /*
    js-popunder
    pure javascript function for creating pop-under windows
    https://github.com/tuki/js-popunder
    */function jsPopunder(e,t){function d(){try{c=Math.floor(document.cookie.split(h+"Cap=")[1].split(";")[0])}catch(e){}return l<=c||document.cookie.indexOf(h+"=")!==-1}function v(e,t,i,s,o,u){if(d())return;var a="toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width="+i.toString()+",height="+s.toString()+",screenX="+o+",screenY="+u,l=function(){if(d())return;r=n.window.open(e,t,a);if(r){var i=new Date,s=new Date(i.setTime(i.getTime()+f));document.cookie=h+"=1;expires="+s.toGMTString()+";path=/";var o=new Date;o.setHours(24,0,0,0),document.cookie=h+"Cap="+(c+1)+";expires="+o.toGMTString()+";path=/",m()}};document.addEventListener?document.addEventListener("click",l,!1):document.attachEvent("onclick",l)}function m(){try{r.blur(),r.opener.window.focus(),window.self.window.focus(),window.focus(),p.firefox&&g(),p.webkit&&y(),p.msie&&setTimeout(function(){r.blur(),r.opener.window.focus(),window.self.window.focus(),window.focus()},1e3)}catch(e){}}function g(){var e=window.open("about:blank");e.focus(),e.close()}function y(){var e="",t=document.createElement("a");t.href="data:text/html,<scr"+e+"ipt>window.close();</scr"+e+"ipt>",document.getElementsByTagName("body")[0].appendChild(t);var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!1,!0,window,0,0,0,0,0,!0,!1,!1,!0,0,null),t.dispatchEvent(n),t.parentNode.removeChild(t)}var n=top!=self&&typeof top.document.location.toString()=="string"?top:self,r=null;t=t||{};var i=t.name||Math.floor(Math.random()*1e3+1),s=t.width||window.outerWidth||window.innerWidth,o=t.height||window.outerHeight-100||window.innerHeight,u=typeof t.left!="undefined"?t.left.toString():window.screenX,a=typeof t.top!="undefined"?t.top.toString():window.screenY,f=t.wait||10;f*=1e3;var l=t.cap||20,c=0,h=t.cookie||"__.popunder",p=function(){var e=navigator.userAgent.toLowerCase(),t={webkit:/webkit/.test(e),mozilla:/mozilla/.test(e)&&!/(compatible|webkit)/.test(e),chrome:/chrome/.test(e),msie:/msie/.test(e)&&!/opera/.test(e),firefox:/firefox/.test(e),safari:/safari/.test(e)&&!/chrome/.test(e),opera:/opera/.test(e)};return t.version=t.safari?(e.match(/.+(?:ri)[\/: ]([\d.]+)/)||[])[1]:(e.match(/.+(?:ox|me|ra|ie)[\/: ]([\d.]+)/)||[])[1],t}();if(d())return;v(e,i,s,o,u,a)};

    from this code i call function another place like
    Code:
    <script src="jspopunder.min.js"></script>
    	<script>
    	jsPopunder('http://www.google.com');
        </script>
    its show me popunder when click any where on browser its fine

    but i want my user use only this script not above code with function

    Code:
    <script src="jspopunder.min.js"></script>
    and my user use this script only

    and i want this code work in above src link code its is possible
    Code:
    <script>
    	jsPopunder('http://www.google.com');
        </script>

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    I think I understand your question

    You want to include the call to jsPopunder(...) into the jspopunder.min.js itself.

    But I don't understand WHY you want to do that? Besides, noone will stop you from adding the call to jsPopunder(...) to the jspopunder.min.js. So did you even try to do it?

  • #3
    New Coder
    Join Date
    May 2012
    Posts
    59
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yes exactly i want this and
    i want main script for my user use like this

    Code:
    <script>
    	siteid='17';
           userid='25';
        </script>
    <script src="jspopunder.min.js"></script>
    and also site id userid right its value to jspopunder.min.js include code
    how to do this?

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,640
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by blacktiger786 View Post
    and also site id userid right its value to jspopunder.min.js include code
    how to do this?
    Addf jsPopunder('http://www.google.com'); to the end of the jspopunder.min.js file.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •