scripts moved to an extension
git-svn-id: file:///home/shish/svn/shimmie2/trunk@81 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
5c16e860a1
commit
e2e7d29b66
3 changed files with 86 additions and 61 deletions
20
core/ext/load_ext_data.ext.php
Normal file
20
core/ext/load_ext_data.ext.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
class LoadExtData extends Extension {
|
||||||
|
public function receive_event($event) {
|
||||||
|
if(is_a($event, 'PageRequestEvent')) {
|
||||||
|
global $page, $config;
|
||||||
|
|
||||||
|
$data_href = $config->get_string("data_href");
|
||||||
|
|
||||||
|
foreach(glob("ext/*/style.css") as $css_file) {
|
||||||
|
$page->add_header("<link rel='stylesheet' href='$data_href/$css_file' type='text/css'>");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(glob("ext/*/script.js") as $js_file) {
|
||||||
|
$page->add_header("<script src='$data_href/$js_file' type='text/javascript'></script>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_event_listener(new LoadExtData());
|
||||||
|
?>
|
|
@ -1,3 +1,69 @@
|
||||||
|
var defaultTexts = new Array();
|
||||||
|
|
||||||
|
window.onload = function(e) {
|
||||||
|
var sections=get_sections();
|
||||||
|
for(var i=0;i<sections.length;i++) toggle(sections[i]);
|
||||||
|
|
||||||
|
initGray("search_input", "Search");
|
||||||
|
initGray("commentBox", "Comment");
|
||||||
|
initGray("tagBox", "tagme");
|
||||||
|
|
||||||
|
// if we're going to show with JS, hide with JS first
|
||||||
|
pass_confirm = byId("pass_confirm");
|
||||||
|
if(pass_confirm) {
|
||||||
|
pass_confirm.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function initGray(boxname, text) {
|
||||||
|
var box = byId(boxname);
|
||||||
|
if(!box) return;
|
||||||
|
|
||||||
|
addEvent(box, "focus", function f() {cleargray(box, text);}, false);
|
||||||
|
addEvent(box, "blur", function f() {setgray(box, text);}, false);
|
||||||
|
|
||||||
|
if(box.value == text) {
|
||||||
|
box.style.color = "#999";
|
||||||
|
box.style.textAlign = "center";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
box.style.color = "#000";
|
||||||
|
box.style.textAlign = "left";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleargray(box, text) {
|
||||||
|
if(box.value == text) {
|
||||||
|
box.value = "";
|
||||||
|
box.style.color = "#000";
|
||||||
|
box.style.textAlign = "left";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setgray(box, text) {
|
||||||
|
if(box.value == "") {
|
||||||
|
box.style.textAlign = "center";
|
||||||
|
box.style.color = "gray";
|
||||||
|
box.value = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showUp(elem) {
|
||||||
|
e = document.getElementById(elem)
|
||||||
|
if(!e) return;
|
||||||
|
e.style.display = "";
|
||||||
|
// alert(e.type+": "+e.value);
|
||||||
|
if(e.value.match(/^http|^ftp/)) {
|
||||||
|
e.type = "text";
|
||||||
|
alert("Box is web upload");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||||
|
* LibShish-JS *
|
||||||
|
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
function addEvent(obj, event, func, capture){
|
function addEvent(obj, event, func, capture){
|
||||||
if (obj.addEventListener){
|
if (obj.addEventListener){
|
||||||
obj.addEventListener(event, func, capture);
|
obj.addEventListener(event, func, capture);
|
|
@ -1,61 +0,0 @@
|
||||||
var defaultTexts = new Array();
|
|
||||||
|
|
||||||
window.onload = function(e) {
|
|
||||||
var sections=get_sections();
|
|
||||||
for(var i=0;i<sections.length;i++) toggle(sections[i]);
|
|
||||||
|
|
||||||
initGray("search_input", "Search");
|
|
||||||
initGray("commentBox", "Comment");
|
|
||||||
initGray("tagBox", "tagme");
|
|
||||||
|
|
||||||
// if we're going to show with JS, hide with JS first
|
|
||||||
pass_confirm = byId("pass_confirm");
|
|
||||||
if(pass_confirm) {
|
|
||||||
pass_confirm.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function initGray(boxname, text) {
|
|
||||||
var box = byId(boxname);
|
|
||||||
if(!box) return;
|
|
||||||
|
|
||||||
addEvent(box, "focus", function f() {cleargray(box, text);}, false);
|
|
||||||
addEvent(box, "blur", function f() {setgray(box, text);}, false);
|
|
||||||
|
|
||||||
if(box.value == text) {
|
|
||||||
box.style.color = "#999";
|
|
||||||
box.style.textAlign = "center";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
box.style.color = "#000";
|
|
||||||
box.style.textAlign = "left";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleargray(box, text) {
|
|
||||||
if(box.value == text) {
|
|
||||||
box.value = "";
|
|
||||||
box.style.color = "#000";
|
|
||||||
box.style.textAlign = "left";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function setgray(box, text) {
|
|
||||||
if(box.value == "") {
|
|
||||||
box.style.textAlign = "center";
|
|
||||||
box.style.color = "gray";
|
|
||||||
box.value = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showUp(elem) {
|
|
||||||
e = document.getElementById(elem)
|
|
||||||
if(!e) return;
|
|
||||||
e.style.display = "";
|
|
||||||
// alert(e.type+": "+e.value);
|
|
||||||
if(e.value.match(/^http|^ftp/)) {
|
|
||||||
e.type = "text";
|
|
||||||
alert("Box is web upload");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Reference in a new issue