From abc1901eac4ee822eb3f25d0bfff67d39c9633f6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 31 Jan 2010 20:30:51 -0600 Subject: Remove checked-in admin_media directory This is a bad idea because it will get outdated quickly when django changes and we should just use the version it distributes anyway. Signed-off-by: Dan McGee --- media/admin_media/js/SelectBox.js | 111 -------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 media/admin_media/js/SelectBox.js (limited to 'media/admin_media/js/SelectBox.js') diff --git a/media/admin_media/js/SelectBox.js b/media/admin_media/js/SelectBox.js deleted file mode 100644 index f28c861..0000000 --- a/media/admin_media/js/SelectBox.js +++ /dev/null @@ -1,111 +0,0 @@ -var SelectBox = { - cache: new Object(), - init: function(id) { - var box = document.getElementById(id); - var node; - SelectBox.cache[id] = new Array(); - var cache = SelectBox.cache[id]; - for (var i = 0; (node = box.options[i]); i++) { - cache.push({value: node.value, text: node.text, displayed: 1}); - } - }, - redisplay: function(id) { - // Repopulate HTML select box from cache - var box = document.getElementById(id); - box.options.length = 0; // clear all options - for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) { - var node = SelectBox.cache[id][i]; - if (node.displayed) { - box.options[box.options.length] = new Option(node.text, node.value, false, false); - } - } - }, - filter: function(id, text) { - // Redisplay the HTML select box, displaying only the choices containing ALL - // the words in text. (It's an AND search.) - var tokens = text.toLowerCase().split(/\s+/); - var node, token; - for (var i = 0; (node = SelectBox.cache[id][i]); i++) { - node.displayed = 1; - for (var j = 0; (token = tokens[j]); j++) { - if (node.text.toLowerCase().indexOf(token) == -1) { - node.displayed = 0; - } - } - } - SelectBox.redisplay(id); - }, - delete_from_cache: function(id, value) { - var node, delete_index = null; - for (var i = 0; (node = SelectBox.cache[id][i]); i++) { - if (node.value == value) { - delete_index = i; - break; - } - } - var j = SelectBox.cache[id].length - 1; - for (var i = delete_index; i < j; i++) { - SelectBox.cache[id][i] = SelectBox.cache[id][i+1]; - } - SelectBox.cache[id].length--; - }, - add_to_cache: function(id, option) { - SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); - }, - cache_contains: function(id, value) { - // Check if an item is contained in the cache - var node; - for (var i = 0; (node = SelectBox.cache[id][i]); i++) { - if (node.value == value) { - return true; - } - } - return false; - }, - move: function(from, to) { - var from_box = document.getElementById(from); - var to_box = document.getElementById(to); - var option; - for (var i = 0; (option = from_box.options[i]); i++) { - if (option.selected && SelectBox.cache_contains(from, option.value)) { - SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); - SelectBox.delete_from_cache(from, option.value); - } - } - SelectBox.redisplay(from); - SelectBox.redisplay(to); - }, - move_all: function(from, to) { - var from_box = document.getElementById(from); - var to_box = document.getElementById(to); - var option; - for (var i = 0; (option = from_box.options[i]); i++) { - if (SelectBox.cache_contains(from, option.value)) { - SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); - SelectBox.delete_from_cache(from, option.value); - } - } - SelectBox.redisplay(from); - SelectBox.redisplay(to); - }, - sort: function(id) { - SelectBox.cache[id].sort( function(a, b) { - a = a.text.toLowerCase(); - b = b.text.toLowerCase(); - try { - if (a > b) return 1; - if (a < b) return -1; - } - catch (e) { - // silently fail on IE 'unknown' exception - } - return 0; - } ); - }, - select_all: function(id) { - var box = document.getElementById(id); - for (var i = 0; i < box.options.length; i++) { - box.options[i].selected = 'selected'; - } - } -} -- cgit v1.2.3-24-g4f1b