IE does not support index of.

pull/420/head
Chad Weider 2012-02-06 12:36:45 -08:00
parent 394d542d5e
commit 2f32f5a6aa
1 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,15 @@ var padutils = require('/pad_utils').padutils;
var padeditor = require('/pad_editor').padeditor;
var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
function indexOf(array, value) {
for (var i = 0, ii = array.length; i < ii; i++) {
if (array[i] == value) {
return i;
}
}
return -1;
}
var padeditbar = (function()
{
@ -190,7 +199,7 @@ var padeditbar = (function()
}
else
{
var nth_child = modules.indexOf(moduleName) + 1;
var nth_child = indexOf(modules, moduleName) + 1;
if (nth_child > 0 && nth_child <= 3) {
$("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected");
$("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("selected");