diff --git a/content/buffer.js b/content/buffer.js index 20479f92..ebfd0a71 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -1486,31 +1486,20 @@ liberator.Marks = function () //{{{ function getSortedMarks() { + var lmarks, umarks; + // local marks - var lmarks = []; - - for (var mark in localMarks) - { - for (var i = 0; i < localMarks[mark].length; i++) - { - if (localMarks[mark][i].location == window.content.location.href) - lmarks.push([mark, localMarks[mark][i]]); - } - } - + lmarks = [[[mark, value[i]] for (i in value) + if (value[i].location == window.content.location.href)] + for ([mark, value] in Iterator(localMarks))]; + lmarks = Array.concat.apply(Array, lmarks); lmarks.sort(); // URL marks - var umarks = []; - // FIXME: why does umarks.sort() cause a "Component is not available = // NS_ERROR_NOT_AVAILABLE" exception when used here? - for (var mark in urlMarks) - umarks.push([mark, urlMarks[mark]]); - - umarks.sort(function (a, b) { - return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0; - }); + umarks = [[key, mark] for ([key, mark] in Iterator(urlMarks))]; + umarks.sort(function (a, b) a[0].localeCompare(b[0])); return lmarks.concat(umarks); } diff --git a/content/editor.js b/content/editor.js index 30819cc8..4d660b0a 100644 --- a/content/editor.js +++ b/content/editor.js @@ -878,20 +878,16 @@ liberator.Editor = function () //{{{ } // } - // blink the textbox after returning - TODO: could use setInterval + // blink the textbox after returning if (textBox) { var timeout = 100; - textBox.style.backgroundColor = tmpBg; - setTimeout(function () { - textBox.style.backgroundColor = oldBg; - setTimeout(function () { - textBox.style.backgroundColor = tmpBg; - setTimeout(function () { - textBox.style.backgroundColor = oldBg; - }, timeout); - }, timeout); - }, timeout); + var colors = [tmpBg, oldBg, tmpBg, oldBg]; + (function() { + textBox.style.backgroundColor = colors.shift(); + if(colors.length > 0) + setTimeout(arguments.callee, timeout) + })(); } tmpfile.remove(false);