javascript - TypeError: $.XXXXX is not a function after adding jquery? -


hi have code needs jquery in page .

https://jsfiddle.net/sysgn9pe/3/

i use code import latest jquery :

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

but after adding code , chat script face problem on console :

typeerror: $.newwindow not function chat-mobi.js:343:0 typeerror: $.updatewindowcontentwithajax not function 

and here codes :

    $.newwindow({         id: "register",         title: 'fast signup system' ,         width: 240,         height: 140,         posx: math.floor(math.random() * 50) + 150,         posy:  math.floor(math.random() * 50) + 150,         content: "password : <br><input type='password' id='regpw' name='regpw'><br>again : <br><input type='password' id='regpwconfrim' name='regpwconfrim'><br><a href='javascript:;' onclick='register();'>sign</a>",         statusbar: true,         minimizebutton: false,         maximizebutton: false,         closebutton: true,         draggable: true,         resizeable: true     });  } 

and other 1 :

 function updatehistory(){     $.updatewindowcontentwithajax('history','./?history&'+self.ri+"&"+self.rn);  } 

script fine before adding jquery

i have window.js .newwindow

var jqwindowsenginezindex=100;jquery.extend({newwindow:function(e){var t=0;var n=0;var r={id:"",title:"",width:300,height:200,posx:50,posy:50,content:"",ondragbegin:null,ondragend:null,onresizebegin:null,onresizeend:null,onajaxcontentloaded:null,onwindowclose:null,statusbar:true,minimizebutton:true,maximizebutton:true,closebutton:true,draggable:true,resizeable:true,type:"normal",modal:false};var e=$.extend(r,e);var i="";if(e.id!="")i='id="'+e.id+'"';$modalbackground=$('<div class="modal-background"></div>');$modalbackground.css("z-index","10000");$windowcontainer=$("<div "+i+' class="window-container"></div>');$titlebar=$('<div class="window-titlebar"></div>');$titlebar.append('<div class="window-titlebar-leftcorner"></div>');$titlebarcontent=$('<div class="window-titlebar-content">'+e.title+"</div>");$titlebar.append($titlebarcontent);$titlebar.append('<div class="window-titlebar-rightcorner"></div>');$windowminimizebutton=$('<div class="window-minimizebutton"></div>');$windowmaximizebutton=$('<div class="window-maximizebutton"></div>');$windowclosebutton=$('<div class="window-closebutton"></div>');$windowcontent=$('<div class="window-content"></div>');$windowstatusbar=$('<div class="window-statusbar"></div>');$windowresizeicon=$('<div class="window-resizeicon"></div>');if(e.minimizebutton)$titlebar.append($windowminimizebutton);if(e.maximizebutton)$titlebar.append($windowmaximizebutton);if(e.closebutton)$titlebar.append($windowclosebutton);if(e.resizeable)$windowstatusbar.append($windowresizeicon);$windowcontainer.append($titlebar);$windowcontent.append(e.content);$windowcontainer.append($windowcontent);if(e.statusbar)$windowcontainer.append($windowstatusbar);if(e.type==="iframe"){$windowcontent.css("overflow","hidden")}var s=function(){document.onselectstart=function(){return false}};var o=function(){document.onselectstart=null};var u=function(t){if(e.modal){t.css("z-index",10001)}else{t.css("z-index",jqwindowsenginezindex++)}};var a=function(t,n,r){n=parseint(n);r=parseint(r);t.data("lastwidth",n).data("lastheight",r);t.css("width",n+"px").css("height",r+"px");if(e.type==="iframe"){var i=3,s=2;if($.browser.msie&&$.browser.version<9)i=s=0;t.find("iframe").css("width",n-i+"px").css("height",r-s+"px");t.find("iframe").each(function(){$("#jquery-window-engine-iframe-cover").css({top:$(this).offset().top,left:$(this).offset().left,width:this.offsetwidth,height:this.offsetheight,position:"absolute",opacity:"0.0001",zindex:1e4,background:"#444"})})}};var f=function(t,n,r){n=math.max(0,parseint(n));r=math.max(0,parseint(r));t.data("lastx",n).data("lasty",r);n=n+"px";r=r+"px";t.css("left",n).css("top",r);if(e.type==="iframe"){t.find("iframe").each(function(){$("#jquery-window-engine-iframe-cover").css({top:$(this).offset().top,left:$(this).offset().left,width:this.offsetwidth,height:this.offsetheight,position:"absolute",opacity:"0.0001",zindex:1e4,background:"#444"})})}};var l=function(r,i){if(e.draggable){r=r?r:window.event;var s=parseint(i.css("left"))+(r.clientx-t);var o=parseint(i.css("top"))+(r.clienty-n);t=r.clientx;n=r.clienty;f(i,s,o)}};var c=function(e,r){e=e?e:window.event;var i=parseint(r.css("width"));var s=parseint(r.css("height"));i=i<100?100:i;s=s<50?50:s;var o=i+(e.clientx-t);var u=s+(e.clienty-n);t=e.clientx;n=e.clienty;a(r,o,u)};$titlebarcontent.bind("mousedown.jquerywindow",function(r){$obj=$(r.target).parent().parent();u($obj);s();if($obj.data("state")!="maximized"){if(e.type==="iframe"){var i=$('<div id="jquery-window-engine-iframe-cover" ></div>');$obj.find("iframe").each(function(){i.css({top:$(this).offset().top,left:$(this).offset().left,width:this.offsetwidth,height:this.offsetheight,position:"absolute",opacity:"0.0001",zindex:1e4,background:"#444"});$("body").append(i)})}r=r?r:window.event;t=r.clientx;n=r.clienty;$(document).bind("mousemove.jquerywindow",function(e){l(e,$obj)});$(document).bind("mouseup.jquerywindow",function(t){if(e.type==="iframe")$("#jquery-window-engine-iframe-cover").remove();if(e.ondragend!=null)e.ondragend();$(document).unbind("mousemove.jquerywindow");$(document).unbind("mouseup.jquerywindow");o()});if(e.ondragbegin!=null)e.ondragbegin()}else if(e.type==="iframe"){$("#jquery-window-engine-iframe-cover").remove()}return false});$titlebarcontent.dblclick(function(e){$obj=$(e.target).parent().parent();$obj.find(".window-maximizebutton").click()});$windowresizeicon.bind("mousedown.jquerywindow",function(r){$obj=$(r.target).parent().parent();u($obj);s();if($obj.data("state")==="normal"){if(e.type==="iframe"){var i=$('<div id="jquery-window-engine-iframe-cover" ></div>');$obj.find("iframe").each(function(){i.css({top:$(this).offset().top,left:$(this).offset().left,width:this.offsetwidth,height:this.offsetheight,position:"absolute",opacity:"0.0001",zindex:1e4,background:"#444"});$("body").append(i)})}r=r?r:window.event;t=r.clientx;n=r.clienty;$(document).bind("mousemove.jquerywindow",function(e){c(e,$obj)});$(document).bind("mouseup.jquerywindow",function(t){if(e.type==="iframe")$("#jquery-window-engine-iframe-cover").remove();if(e.onresizeend!=null)e.onresizeend();$(document).unbind("mousemove.jquerywindow");$(document).unbind("mouseup.jquerywindow");o()});if(e.onresizebegin!=null)e.onresizebegin()}return false});$windowminimizebutton.bind("click.jquerywindow",function(e){$obj=$(e.target).parent().parent();u($obj);if($obj.data("state")==="minimized"){$obj.data("state","normal");$obj.css("height",$obj.data("lastheight"));$obj.find(".window-content").slidetoggle("slow")}else if($obj.data("state")==="normal"){$obj.data("state","minimized");$obj.find(".window-content").slidetoggle("slow",function(){$obj.css("height",0)})}else{$obj.find(".window-maximizebutton").click()}});$windowmaximizebutton.bind("click.jquerywindow",function(t){$obj=$(t.target).parent().parent();u($obj);var n=3,r=2;if($.browser.msie&&$.browser.version<9)n=r=0;if($obj.data("state")==="minimized"){$obj.find(".window-minimizebutton").click()}else if($obj.data("state")==="normal"){$obj.animate({top:"5px",left:"5px",width:$(window).width()-15,height:$(window).height()-45},"slow");if(e.type==="iframe"){$obj.find("iframe").animate({top:"5px",left:"5px",width:$(window).width()-15-n,height:$(window).height()-45-r},"slow")}$obj.data("state","maximized")}else if($obj.data("state")==="maximized"){$obj.animate({top:$obj.data("lasty"),left:$obj.data("lastx"),width:$obj.data("lastwidth"),height:$obj.data("lastheight")},"slow");if(e.type==="iframe"){$obj.find("iframe").animate({top:$obj.data("lasty"),left:$obj.data("lastx"),width:parseint($obj.data("lastwidth")-n),height:parseint($obj.data("lastheight")-r)},"slow")}$obj.data("state","normal")}});$windowclosebutton.bind("click.jquerywindow",function(t){var n=$(t.target).parent().parent();n.fadeout();if(e.onwindowclose!=null)e.onwindowclose();if(e.modal){$modalbackground.remove()}});$modalbackground.bind("click.jquerywindow",function(e){$windowclosebutton.click()});$windowcontent.click(function(e){u($(e.target).parent())});$windowstatusbar.click(function(e){u($(e.target).parent())});$windowcontainer.data("state","normal");$windowcontainer.css("display","none");$("body").append($windowcontainer);if(e.modal){$("body").append($modalbackground)}$window=$windowcontainer;if(!e.draggable)$window.children(".window-titlebar").css("cursor","default");u($window);f($windowcontainer,e.posx,e.posy);a($windowcontainer,e.width,e.height);$window.fadein()},updatewindowcontent:function(e,t){$("#"+e+" .window-content").html(t)},updatewindowcontentwithajax:function(e,t,n){n=n===undefined?true:false;$.ajax({url:t,cache:n,datatype:"html",success:function(t){$("#"+e+" .window-content").html(t)}})},movewindow:function(e,t,n){$obj=$("#"+e);t=parseint(t);n=parseint(n);$obj.data("lastx",t).data("lasty",n);t=t+"px";n=n+"px";$obj.css("left",t).css("top",n)},resizewindow:function(e,t,n){$obj=$("#"+e);t=parseint(t);n=parseint(n);$obj.data("lastwidth",t).data("lastheight",n);t=t+"px";n=n+"px";$obj.css("width",t).css("height",n)},minimizewindow:function(e){$("#"+e+" .window-minimizebutton").click()},maximizewindow:function(e){$("#"+e+" .window-maximizebutton").click()},showwindow:function(e){$("#"+e+" .window-closebutton").fadein()},hidewindow:function(e){$("#"+e+" .window-closebutton").fadeout()},closewindow:function(e){$("#"+e+" .window-closebutton").click()},closeallwindows:function(){$(".window-container .window-closebutton").click()}}) 

jquery doesn't have $.newwindow or $.updatewindowcontentwithajax methods. looks need include plugin provide these methods.

i.e.,

<script type='text/javascript' src='/path/to/your/js/jquery.windows-engine.js'></script>


Comments