The default theme actually does use this file.
This commit is contained in:
parent
e9b862b560
commit
73c887e30f
3 changed files with 84 additions and 1 deletions
|
@ -15,7 +15,6 @@ window.onload = function(e) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function initGray(boxname, text) {
|
||||
var box = byId(boxname);
|
||||
if(!box) return;
|
||||
|
|
|
@ -56,6 +56,7 @@ class Layout {
|
|||
<title>{$page->title}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
||||
<script src='$data_href/themes/$theme_name/sidebar.js' type='text/javascript'></script>
|
||||
$header_html
|
||||
</head>
|
||||
|
||||
|
|
83
themes/default/sidebar.js
Normal file
83
themes/default/sidebar.js
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* This script shamelessly stolen from wakachan.org d(^_^)b
|
||||
*/
|
||||
|
||||
var cookie_name="shimmie_sidebar";
|
||||
var default_sections=["upload", "edit_tags"];
|
||||
|
||||
function toggle(id)
|
||||
{
|
||||
var e=document.getElementById(id);
|
||||
if(!e) return;
|
||||
if(e.style.display)
|
||||
{
|
||||
remove_section(id);
|
||||
e.style.display="";
|
||||
|
||||
var e2 = document.getElementById(id+"-toggle");
|
||||
if(e2) {
|
||||
e2.style.color = "#000";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_section(id);
|
||||
e.style.display="none";
|
||||
|
||||
var e2 = document.getElementById(id+"-toggle");
|
||||
if(e2) {
|
||||
e2.style.color = "#AAA";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function add_section(id)
|
||||
{
|
||||
var sections=get_sections();
|
||||
for(var i=0;i<sections.length;i++) if(sections[i]==id) return;
|
||||
sections.push(id);
|
||||
set_sections(sections);
|
||||
}
|
||||
|
||||
function remove_section(id)
|
||||
{
|
||||
var sections=get_sections();
|
||||
var new_sections=new Array();
|
||||
for(var i=0;i<sections.length;i++) if(sections[i]!=id) new_sections.push(sections[i]);
|
||||
set_sections(new_sections);
|
||||
}
|
||||
|
||||
function get_sections()
|
||||
{
|
||||
var cookie=get_cookie(cookie_name);
|
||||
if(cookie) return cookie.split(/,/);
|
||||
else return default_sections;
|
||||
}
|
||||
|
||||
function set_sections(sections) { set_cookie(cookie_name,sections.join(","),365); }
|
||||
|
||||
function get_cookie(name)
|
||||
{
|
||||
with(document.cookie)
|
||||
{
|
||||
var index=indexOf(name+"=");
|
||||
if(index==-1) return '';
|
||||
index=indexOf("=",index)+1;
|
||||
var endstr=indexOf(";",index);
|
||||
if(endstr==-1) endstr=length;
|
||||
return unescape(substring(index,endstr));
|
||||
}
|
||||
};
|
||||
|
||||
function set_cookie(name,value,days)
|
||||
{
|
||||
if(days)
|
||||
{
|
||||
var date=new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
var expires="; expires="+date.toGMTString();
|
||||
}
|
||||
else expires="";
|
||||
document.cookie=name+"="+value+expires+"; path=/";
|
||||
}
|
||||
|
Reference in a new issue