|
From: Jon O. <jon...@us...> - 2007-05-05 20:33:28
|
Update of /cvsroot/mxbb/mx_slides/slides/includes/js In directory sc8-pr-cvs16:/tmp/cvs-serv30431/slides/includes/js Added Files: .htaccess common.js debug.js index.htm init_main.js management.js.php Log Message: First commit --- NEW FILE: management.js.php --- // +--------------------------------------------------------------------+ // | DO NOT REMOVE THIS | // +--------------------------------------------------------------------+ // | management.js | // | Some functions, stuff for documents & folders management. | // +--------------------------------------------------------------------+ // | Author: Cezary Tomczak [www.gosu.pl] | // | Project: SimpleDoc | // | URL: http://gosu.pl/php/simpledoc.html | // | License: GPL | // +--------------------------------------------------------------------+ function Fader(id) { this.fadein = function() { self.direction = 1; self.opacity = 00; this.timerId = setInterval(change, 5); }; this.fadeout = function() { self.direction = 0; self.opacity = 100; this.timerId = setInterval(change, 5); }; this.stop = function() { clearInterval(this.timerId); }; function change() { self.opacity += (self.direction ? 20 : -20); document.getElementById(self.id).style.opacity = self.opacity/100; document.getElementById(self.id).style.MozOpacity = self.opacity/100; document.getElementById(self.id).style.filter = "alpha(opacity="+self.opacity+")"; if (self.opacity == 00 && self.direction == 0) {self.stop();} if (self.opacity == 100 && self.direction == 1) {self.stop();} } var self = this; this.id = id; this.timerId = null; this.opacity = 00; this.direction = 1; } product_update = false; tabsFader = new Fader("tabs-data"); //var tabsLoading = new Fader("tabs-data"); //var tabsSaving = new Fader("tabs-saving"); //var AjaxRequest = new AjaxRequest(); //function tabsLoadingOn() { document.getElementById("tabs-loading").style.display = "block"; tabsLoading.start(); } function tabsLoadingOn() { } //function tabsLoadingOff() { document.getElementById("tabs-loading").style.display = "none"; tabsLoading.stop(); } function tabsLoadingOff() { } //function tabsSavingOn() { document.getElementById("tabs-saving").style.display = "block"; tabsSaving.start(); } function tabsSavingOn() { } //function tabsSavingOff() { document.getElementById("tabs-saving").style.display = "none"; tabsSaving.stop(); } function tabsSavingOff() { } function viewBug(block_id) { if ( !block_id ) { alert("You have to select a Bug to perform this action."); return; } AjaxRequest.get( { 'url':'modules/mx_slides/slides/modules/tabs/slides__tab-index.php' ,'parameters':{ 'slides_block_id': block_id, 'mode':'view', 'block_id':mxBlock.block_id, 'page_id':mxBlock.page_id } ,'onLoading':function() { clearTabs(); tabsFader.fadeout();} ,'onComplete':function() { runSlideShow(); tabsLoadingOff(); tabsFader.fadein();} ,'onSuccess':function(req){ el('tabs-data').innerHTML = req.responseText; updateTabs('tab_view');} ,'onError':function(req){ el('tabs-data').innerHTML = 'Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;} ,'timeout':5000 ,'onTimeout':function(){ clearTabs(); tabsLoadingOff(); el('tabs-data').innerHTML = 'Timed out. Try again!'; } } ); } function clearTabs() { if(el('tab_bugs')) {el('tab_bugs').className = "tab";} if(el('tab_report')) {el('tab_report').className = "tab view";} if(el('tab_view')) {el('tab_view').className = "tab";} if(el('tab_edit')) {el('tab_edit').className = "tab right";} if(el('tab_delete')) {el('tab_delete').className = "tab view";} if (product_update) { updateTree(); product_update = false; } //if(el('tabs-data')) {el('tabs-data').innerHTML = "";} } function updateTabs(active){ if(el('tab_bugs')) {el('tab_bugs').className = "tab"+((active=='tab_bugs')?"-active":"");} if(el('tab_report')) {el('tab_report').className = "tab"+((active=='tab_report')?"-active":"")+" view";} if(el('tab_view')) {el('tab_view').className = "tab"+((active=='tab_view')?"-active":"")+"";} if(el('tab_edit')) {el('tab_edit').className = "tab"+((active=='tab_edit')?"-active":"")+" right";} if(el('tab_delete')) {el('tab_delete').className = "tab"+((active=='tab_delete')?"-active":"")+" view";} } --- NEW FILE: init_main.js --- // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000; // Initial variables var t; var j = 0; var p = slideBlocks.length; var counter = ""; function runSlideShow(){ blockId = j; resetSlides(); document.getElementById("tree-"+slideBlocks[j]).className = "text-active"; j = j + 1; if (j > (p-1)) j=0; t = setTimeout('viewBug(slideBlocks[j])', slideShowSpeed); countDown(slideShowSpeed/1000); } function resetSlides(){ for (var i = 0; i < p; i++) { document.getElementById("tree-"+slideBlocks[i]).className = "doc"; el('countdown'+i).innerHTML = ""; } } function countDown(count) { clearInterval(counter); currentCount = count; if(el('countdown'+blockId)) {el('countdown'+blockId).innerHTML = currentCount}; currentCount = currentCount - 1; if (currentCount > -1){ counter = window.setTimeout('countDown(currentCount)',1000); } } viewBug(slideBlocks[0]); --- NEW FILE: .htaccess --- allow from all --- NEW FILE: common.js --- // +--------------------------------------------------------------------+ // | DO NOT REMOVE THIS | // +--------------------------------------------------------------------+ // | common.js | // | Some common help functions used all over the project. | // +--------------------------------------------------------------------+ // | Author: Cezary Tomczak [www.gosu.pl] | // | Project: SimpleDoc | // | URL: http://gosu.pl/php/simpledoc.html | // | License: GPL | // +--------------------------------------------------------------------+ function element(id) { return document.getElementById(id); } function elem(id) { return document.getElementById(id); } function el(id) { return document.getElementById(id); } /* Check whether array contains given string */ Array.prototype.contains = function(s) { for (var i = 0; i < this.length; i++) { if (this[i] === s) { return true; } } return false; }; /* Finds the index of the first occurence of item in the array, or -1 if not found */ Array.prototype.indexOf = function(item) { for (var i = 0; i < this.length; i++) { if (this[i] === item) { return i; } } return -1; }; /* Get the last element from the array */ Array.prototype.getLast = function() { return this[this.length-1]; }; /* Remove element with given index (mutates) */ Array.prototype.removeByIndex = function(index) { this.splice(index, 1); }; /* Remove elements with such value (mutates) */ Array.prototype.removeByValue = function(value) { var i, indexes = []; for (i = 0; i < this.length; i++) { if (this[i] === value) { indexes.push(i); } } for (i = indexes.length - 1; i >= 0; i--) { this.splice(indexes[i], 1); } }; /* Push an element at specified index */ Array.prototype.pushAtIndex = function(el, index) { this.splice(index, 0, el); }; /* Strip whitespace from the beginning and end of a string */ String.prototype.trim = function() { return this.replace(/^\s*|\s*$/g, ""); }; /* Count the number of substring occurrences */ String.prototype.substrCount = function(s) { return this.split(s).length - 1; }; // Getting, Setting and Deleteing cookies. // Author: Cezary Tomczak [www.gosu.pl] // Note: name cannot contain 2 chars: =; function Cookie() { this.get = function(name) { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; ++i) { var a = cookies[i].split("="); if (a.length == 2) { a[0] = a[0].trim(); a[1] = a[1].trim(); if (a[0] == name) { return unescape(a[1]); } } } return ""; }; this.set = function(name, value, seconds, path) { var cookie = (name + "=" + escape(value)); if (seconds) { var date = new Date(new Date().getTime()+seconds*1000); cookie += ("; expires="+date.toGMTString()); } cookie += (path ? "; path="+path : ""); document.cookie = cookie; }; this.del = function(name, path) { var cookie = (name + "="); cookie += (path ? "; path="+path : ""); cookie += "; expires=Thu, 01-Jan-70 00:00:01 GMT"; document.cookie = cookie; }; } var COOKIE_MONTH = 3600*24*30; var COOKIE_YEAR = 3600*24*30*12; function getCookie(name) { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; ++i) { var a = cookies[i].split("="); if (a.length == 2) { a[0] = a[0].trim(); a[1] = a[1].trim(); if (a[0] == name) { return unescape(a[1]); } } } return ""; } function setCookie(name, value, seconds, path) { var cookie = (name + "=" + escape(value)); if (seconds) { var date = new Date(new Date().getTime()+seconds*1000); cookie += ("; expires="+date.toGMTString()); } cookie += (path ? "; path="+path : ""); document.cookie = cookie; } function delCookie(name, path) { var cookie = (name + "="); cookie += (path ? "; path="+path : ""); cookie += "; expires=Thu, 01-Jan-70 00:00:01 GMT"; document.cookie = cookie; } function addEvent(obj, event, func) { if (obj.addEventListener) { obj.addEventListener(event, func, false); } else if (obj.attachEvent) { obj.attachEvent("on"+event, func); } } --- NEW FILE: debug.js --- var debugWindow = null; function debug(s, name) { if (!debugWindow) { debugWindow = window.open("", "debugWindow", "width=400,height=500,scrollbars=yes,resizable=yes"); debugWindow.document.write("<pre>"); } if (name) { debugWindow.document.write('<div style="font: 12px sans-serif; font-weight: bold;">'+name+'</div>'); } debugWindow.document.write(s + "\n"); } function debugObject(obj, name) { var s = ''; for (var i in obj) { if (obj[i] && (typeof obj[i] == "object" || typeof obj[i] == "function") && obj[i].toString) { s += "Object." + i + "=" + obj[i].toString().replace(/\n/g, "") + "\n"; } else { s += "Object." + i + "=" + obj[i] + "\n"; } } debug(s, name); } function debugArray(arr, name) { var s = ''; for (var i = 0; i < arr.length; ++i) { s += "Array[" + i + "]=" + arr[i] + "\n"; } debug(s, name); } --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |