aboutsummaryrefslogtreecommitdiffstats
path: root/themes/elegant/scripts.js
diff options
context:
space:
mode:
authorZaphod <zaphod@piwigo.org>2012-03-25 19:23:03 +0000
committerZaphod <zaphod@piwigo.org>2012-03-25 19:23:03 +0000
commitd91cd45790fd5a6a717af472f6459862dc38ea14 (patch)
treeb98cf863bda2fe73c62b363455fe665dbef7cbdf /themes/elegant/scripts.js
parentb1041fb217940f8e34a85cea63c27814f6df0dde (diff)
feature 2587: theme elegant, new version
git-svn-id: http://piwigo.org/svn/trunk@13730 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--themes/elegant/scripts.js131
1 files changed, 50 insertions, 81 deletions
diff --git a/themes/elegant/scripts.js b/themes/elegant/scripts.js
index d6e9d7cc5..20433ac65 100644
--- a/themes/elegant/scripts.js
+++ b/themes/elegant/scripts.js
@@ -1,109 +1,78 @@
-jQuery("document").ready(function(jQuery){
-
- var menubar=jQuery("#menubar");
- var content=jQuery("#content");
-
- if ( (menubar.length == 1) && (content.length ==1)) {
- menubar.after("<div id=\"menuswitcher\">«</div>");
-
- jQuery("#menuswitcher").click(function(){
- if (jQuery("#menubar").is(":hidden")) {
- showMenu(0);
- return false;
- } else {
- hideMenu(0);
- return false;
- }
- });
-
- // creates a variable with the contents of the cookie side-menu
- var sidemenu = jQuery.cookie('side-menu');
-
- // if cookie says the menu is hiding, keep it hidden!
- if (sidemenu == 'hiding') {
- hideMenu(0);
- } else {
- showMenu(0);
- }
-
- }
-
- var comments=jQuery("#thePicturePage #comments");
- if (comments.length == 1) {
- var comments_button=jQuery("#comments h3");
-
- if (comments_button.length == 0) {
- jQuery("#addComment").before("<h3>Comments</h3>");
- comments_button=jQuery("#comments h3");
- }
-
- if (jQuery.cookie('comments') == 'visible') {
- comments_button.addClass("comments_toggle").addClass("comments_toggle_off");
- } else {
- comments.addClass("comments_hidden");
- comments_button.addClass("comments_toggle").addClass("comments_toggle_on");
- }
-
- comments_button.click(function() {
+/**
+ * Cookie plugin
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT and GPL licenses:
+ */
+jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;}
+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;}
+expires='; expires='+date.toUTCString();}
+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;}}}
+return cookieValue;}};
- var comments=jQuery("#thePicturePage #comments");
- if (comments.hasClass("comments_hidden")) {
- comments.removeClass("comments_hidden");
- comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");;
- jQuery.cookie('comments', 'visible', {path: "/"});
- } else {
- comments.addClass("comments_hidden");
- comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");;
- jQuery.cookie('comments', 'hidden', {path: "/"});
- }
-
- });
-
- }
-
-
-});
+if (jQuery.cookie('page-menu') == 'hidden') {
+ jQuery("head").append("<style type=\"text/css\">#the_page #menubar {display:none;} #content.contentWithMenu, #the_page > .content {margin-left:35px;}</style>");
+} else {
+ jQuery("head").append("<style type=\"text/css\">#content.contentWithMenu, #the_page > .content {margin-left:240px;}</style>");
+}
function hideMenu(delay) {
-
var menubar=jQuery("#menubar");
- var menuswitcher=jQuery("#menuswitcher");
+ var menuswitcher=jQuery("#menuSwitcher");
var content=jQuery("#the_page > .content");
var pcontent=jQuery("#content");
menubar.hide(delay);
menuswitcher.addClass("menuhidden").removeClass("menushown");
- menuswitcher.text("»");
content.addClass("menuhidden").removeClass("menushown");
pcontent.addClass("menuhidden").removeClass("menushown");
- jQuery.cookie('side-menu', 'hiding', {path: "/"});
+ jQuery.cookie('page-menu', 'hidden', {path: "/"});
}
function showMenu(delay) {
var menubar=jQuery("#menubar");
- var menuswitcher=jQuery("#menuswitcher");
+ var menuswitcher=jQuery("#menuSwitcher");
var content=jQuery("#the_page > .content");
var pcontent=jQuery("#content");
menubar.show(delay);
menuswitcher.addClass("menushown").removeClass("menuhidden");
- menuswitcher.text("«");
content.addClass("menushown").removeClass("menuhidden");
pcontent.addClass("menushown").removeClass("menuhidden");
- jQuery.cookie('side-menu', 'showing', {path: "/"});
+ jQuery.cookie('page-menu', 'visible', {path: "/"});
}
-/**
- * Cookie plugin
- * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
- * Dual licensed under the MIT and GPL licenses:
- */
-jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;}
-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;}
-expires='; expires='+date.toUTCString();}
-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;}}}
-return cookieValue;}};
+jQuery("document").ready(function(jQuery){
+
+ var sidemenu = jQuery.cookie('page-menu');
+ var menubar=jQuery("#menubar");
+
+ if (menubar.length == 1) {
+
+ jQuery("#menuSwitcher").html("<div class=\"switchArrow\">&nbsp;</div>");
+
+ // if cookie says the menu is hiding, keep it hidden!
+ if (sidemenu == 'hidden') {
+ hideMenu(0);
+ } else {
+ showMenu(0);
+ }
+
+ jQuery("#menuSwitcher").click(function(){
+ if (jQuery("#menubar").is(":hidden")) {
+ showMenu(0);
+ return false;
+ } else {
+ hideMenu(0);
+ return false;
+ }
+ });
+
+
+ }
+
+});
+