1 | jQuery.noConflict(); |
---|
2 | |
---|
3 | jQuery(document).ready(function($){ |
---|
4 | $("#theComments h3").click(function () { |
---|
5 | $("#theComments > div").toggle("slow"); |
---|
6 | }); |
---|
7 | |
---|
8 | $("#menuswitcher").click(function(){ |
---|
9 | if ($("#menubar").is(":hidden")) { |
---|
10 | $("#menubar").show("slow"); |
---|
11 | $.cookie('side-menu', 'showing', {path: "/"}); |
---|
12 | return false; |
---|
13 | } else { |
---|
14 | $("#menubar").hide("slow"); |
---|
15 | $.cookie('side-menu', 'hiding', {path: "/"}); |
---|
16 | return false; |
---|
17 | } |
---|
18 | }); |
---|
19 | |
---|
20 | // creates a variable with the contents of the cookie side-menu |
---|
21 | var sidemenu = $.cookie('side-menu'); |
---|
22 | // if cookie says the menu is hiding, keep it hidden! |
---|
23 | if (sidemenu == 'hiding') { |
---|
24 | $("#menubar").hide(); |
---|
25 | } |
---|
26 | if (sidemenu == 'showing') { |
---|
27 | $("#menubar").show(); |
---|
28 | }; |
---|
29 | }); |
---|
30 | |
---|
31 | /** |
---|
32 | * Cookie plugin |
---|
33 | * Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
---|
34 | * Dual licensed under the MIT and GPL licenses: |
---|
35 | */ |
---|
36 | jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1;} |
---|
37 | var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} |
---|
38 | expires='; expires='+date.toUTCString();} |
---|
39 | var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}} |
---|
40 | return cookieValue;}}; |
---|
41 | |
---|
42 | /** |
---|
43 | * Piwigo scripts |
---|
44 | */ |
---|
45 | function phpWGOpenWindow(theURL,winName,features) |
---|
46 | {img=new Image();img.src=theURL;if(img.complete) |
---|
47 | {var width=img.width+40;var height=img.height+40;} |
---|
48 | else |
---|
49 | {var width=640;var height=480;img.onload=resizeWindowToFit;} |
---|
50 | newWin=window.open(theURL,winName,features+',left=2,top=1,width='+width+',height='+height);} |
---|
51 | function resizeWindowToFit() |
---|
52 | {newWin.resizeTo(img.width+50,img.height+100);} |
---|
53 | function popuphelp(url) |
---|
54 | {window.open(url,'dc_popup','alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no');} |
---|
55 | Function.prototype.pwgBind=function(){var __method=this,object=arguments[0],args=new Array();for(var i=1;i<arguments.length;i++) |
---|
56 | args[i-1]=arguments[i];return function(){return __method.apply(object,args);}} |
---|
57 | function PwgWS(urlRoot) |
---|
58 | {this.urlRoot=urlRoot;this.options={method:"GET",async:true,onFailure:null,onSuccess:null};};PwgWS.prototype={callService:function(method,parameters,options) |
---|
59 | {if(options) |
---|
60 | {for(var property in options) |
---|
61 | this.options[property]=options[property];} |
---|
62 | try{this.transport=new XMLHttpRequest();} |
---|
63 | catch(e){try{this.transport=new ActiveXObject('Msxml2.XMLHTTP');} |
---|
64 | catch(e){try{this.transport=new ActiveXObject('Microsoft.XMLHTTP');} |
---|
65 | catch(e){dispatchError(0,"Cannot create request object");}}} |
---|
66 | this.transport.onreadystatechange=this.onStateChange.pwgBind(this);var url=this.urlRoot+"ws.php?format=json";var body="method="+method;if(parameters) |
---|
67 | {for(var property in parameters) |
---|
68 | {if(typeof parameters[property]=='object'&¶meters[property]) |
---|
69 | {for(var i=0;i<parameters[property].length;i++) |
---|
70 | body+="&"+property+"[]="+encodeURIComponent(parameters[property][i]);} |
---|
71 | else |
---|
72 | body+="&"+property+"="+encodeURIComponent(parameters[property]);}} |
---|
73 | if(this.options.method=="POST") |
---|
74 | {this.transport.open(this.options.method,url,this.options.async);this.transport.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.transport.send(body);} |
---|
75 | else |
---|
76 | {url+="&"+body;this.transport.open(this.options.method,url,this.options.async);this.transport.send(null);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState==4) |
---|
77 | this.respondToReadyState(this.transport.readyState);},dispatchError:function(httpCode,text) |
---|
78 | {!this.options.onFailure||this.options.onFailure(httpCode,text);},respondToReadyState:function(readyState) |
---|
79 | {var transport=this.transport;if(readyState==4&&transport.status==200) |
---|
80 | {var resp;try{eval('resp = '+transport.responseText);} |
---|
81 | catch(e){this.dispatchError(200,e.message+'\n'+transport.responseText.substr(0,512));} |
---|
82 | if(resp!=null) |
---|
83 | {if(resp.stat==null) |
---|
84 | this.dispatchError(200,"Invalid response");else if(resp.stat=='ok') |
---|
85 | {if(this.options.onSuccess)this.options.onSuccess(resp.result);} |
---|
86 | else |
---|
87 | this.dispatchError(200,resp.err+" "+resp.message);}} |
---|
88 | if(readyState==4&&transport.status!=200) |
---|
89 | this.dispatchError(transport.status,transport.statusText);},transport:null,urlRoot:null,options:{}} |
---|