From 3700f44dcd4fddb7798619451275b05f12a99032 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 26 Sep 2012 14:32:58 +0800 Subject: Bug 437212: sync bmo code with upstream --- js/show_bug.js | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 js/show_bug.js (limited to 'js/show_bug.js') diff --git a/js/show_bug.js b/js/show_bug.js deleted file mode 100644 index 07276075f..000000000 --- a/js/show_bug.js +++ /dev/null @@ -1,42 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This Source Code Form is "Incompatible With Secondary Licenses", as - * defined by the Mozilla Public License, v. 2.0. */ - -function getPreSelectedIndex(el) { - var options = el.options; - for (var i = 0, l = options.length; i < l; i++) { - var attributes = options[i].attributes; - for (var j = 0, m = attributes.length; j < m; j++) { - if (attributes[j].name == 'selected') { - return i; - } - } - } - return -1; -} - -// Force the browser to honour the selected option when a page is refreshed, -// but if the user hasn't explicitly selected a different option. -YAHOO.util.Event.onDOMReady(function() { - var selects = document.getElementById('changeform').getElementsByTagName('select'); - for (var i = 0, l = selects.length; i < l; i++) { - var el = selects[i]; - var el_dirty = document.getElementById(el.name + '_dirty'); - if (el_dirty) { - if (!el_dirty.value) { - var preSelectedIndex = getPreSelectedIndex(el); - if (preSelectedIndex != -1) - el.selectedIndex = preselectedIndex; - } - YAHOO.util.Event.on(el, "change", function(e) { - var el = e.target || e.srcElement; - var preSelectedIndex = getPreSelectedIndex(el); - if (preSelectedIndex != -1) - document.getElementById(el.name + '_dirty').value = preSelectedIndex == el.selectedIndex ? '' : '1'; - }); - } - } -}); -- cgit v1.2.3-24-g4f1b