From 6b4f1f73e959e2e26a17885b0fc7aa520cb99b8a Mon Sep 17 00:00:00 2001 From: urs_hunkler Date: Tue, 12 Feb 2008 21:29:16 +0000 Subject: [PATCH] Merged from 1.9 :: MDL-13444 :: removed the jQuery library and use direct JavaScript instead. That's much faster. MDL-12078 :: Changed them calles from themewww to httpsthemwww (MDL-12078). MDL-13421 :: corrected left padding in admin block --- theme/custom_corners/footer.html | 4 +-- theme/custom_corners/header.html | 15 +++------ theme/custom_corners/js/CSSClass.js | 42 +++++++++++++++++++++++ theme/custom_corners/js/CSSClass_min.js | 2 ++ theme/custom_corners/js/js.php | 45 +++++++++++++++++++++++++ theme/custom_corners/meta.php | 4 +-- theme/custom_corners/styles_ie6.css | 3 ++ theme/custom_corners/user_styles.css | 27 +++++---------- 8 files changed, 109 insertions(+), 33 deletions(-) create mode 100644 theme/custom_corners/js/CSSClass.js create mode 100644 theme/custom_corners/js/CSSClass_min.js create mode 100644 theme/custom_corners/js/js.php diff --git a/theme/custom_corners/footer.html b/theme/custom_corners/footer.html index 5fc82ffaa4..cce3af0ec7 100644 --- a/theme/custom_corners/footer.html +++ b/theme/custom_corners/footer.html @@ -34,9 +34,7 @@ if (!$inpopup) { diff --git a/theme/custom_corners/header.html b/theme/custom_corners/header.html index 048b32d96c..c8c311f8c2 100644 --- a/theme/custom_corners/header.html +++ b/theme/custom_corners/header.html @@ -4,13 +4,12 @@ <?php echo $title ?> - + - themedir.'/custom_corners/ui/chameleon.php'); ?> - javascript"); ?> - themedir.'/custom_corners/js/jquery.php'); ?> - - themedir.'/custom_corners/ui/chameleon.php'); + include("$CFG->javascript"); + include($CFG->themedir.'/custom_corners/js/js.php'); // check if page is opened within a popup window if (function_exists('is_in_popup')) { @@ -33,10 +32,6 @@ //replace classlist with new one $bodytags = str_replace($classes[0], 'class="'.implode(' ', $classlist).'"', $bodytags); - - -// $infooutput = '
 
'; - ?> diff --git a/theme/custom_corners/js/CSSClass.js b/theme/custom_corners/js/CSSClass.js new file mode 100644 index 0000000000..1f60ad80e8 --- /dev/null +++ b/theme/custom_corners/js/CSSClass.js @@ -0,0 +1,42 @@ +/** + * CSSClass.js: utilities for manipulating the CSS class of an HTML element. + * + * This module defines a single global symbol named CSSClass. This object + * contains utility functions for working with the class attribute (className + * property) of HTML elements. All functions take two arguments: the element + * e being tested or manipulated and the CSS class c that is to be tested, + * added, or removed. If element e is a string, it is taken as an element + * id and passed to document.getElementById(). + */ +var CSSClass = {}; // Create our namespace object + +// Return true if element e is a member of the class c; false otherwise +CSSClass.is = function(e, c) { + if (typeof e == "string") e = document.getElementById(e); // element id + + // Before doing a regexp search, optimize for a couple of common cases. + var classes = e.className; + if (!classes) return false; // Not a member of any classes + if (classes == c) return true; // Member of just this one class + + // Otherwise, use a regular expression to search for c as a word by itself + // \b in a regular expression requires a match at a word boundary. + return e.className.search("\\b" + c + "\\b") != -1; +}; + +// Add class c to the className of element e if it is not already there. +CSSClass.add = function(e, c) { + if (typeof e == "string") e = document.getElementById(e); // element id + if (CSSClass.is(e, c)) return; // If already a member, do nothing + if (e.className) c = " " + c; // Whitespace separator, if needed + e.className += c; // Append the new class to the end +}; + +// Remove all occurrences (if any) of class c from the className of element e +CSSClass.remove = function(e, c) { + if (typeof e == "string") e = document.getElementById(e); // element id + // Search the className for all occurrences of c and replace with "". + // \s* matches any number of whitespace characters. + // "g" makes the regular expression match any number of occurrences + e.className = e.className.replace(new RegExp("\\b"+ c+"\\b\\s*", "g"), ""); +}; \ No newline at end of file diff --git a/theme/custom_corners/js/CSSClass_min.js b/theme/custom_corners/js/CSSClass_min.js new file mode 100644 index 0000000000..652a00b193 --- /dev/null +++ b/theme/custom_corners/js/CSSClass_min.js @@ -0,0 +1,2 @@ + +var CSSClass={};CSSClass.is=function(e,c){if(typeof e=="string")e=document.getElementById(e);var classes=e.className;if(!classes)return false;if(classes==c)return true;return e.className.search("\\b"+c+"\\b")!=-1;};CSSClass.add=function(e,c){if(typeof e=="string")e=document.getElementById(e);if(CSSClass.is(e,c))return;if(e.className)c=" "+c;e.className+=c;};CSSClass.remove=function(e,c){if(typeof e=="string")e=document.getElementById(e);e.className=e.className.replace(new RegExp("\\b"+c+"\\b\\s*","g"),"");}; \ No newline at end of file diff --git a/theme/custom_corners/js/js.php b/theme/custom_corners/js/js.php new file mode 100644 index 0000000000..e1fc893cc1 --- /dev/null +++ b/theme/custom_corners/js/js.php @@ -0,0 +1,45 @@ + + + \ No newline at end of file diff --git a/theme/custom_corners/meta.php b/theme/custom_corners/meta.php index 6ab875d56a..7c94e3f00b 100644 --- a/theme/custom_corners/meta.php +++ b/theme/custom_corners/meta.php @@ -1,5 +1,5 @@