diff --git a/appchan-x.user.js b/appchan-x.user.js index 88a7020f1..3a48ca28e 100644 --- a/appchan-x.user.js +++ b/appchan-x.user.js @@ -3747,11 +3747,23 @@ return e.stopPropagation(); }, focus: function() { + var items, string; + + string = "" + g.BOARD + "." + this.className; + items = { + title: this.innerHTML + }; + items["" + string] = ''; + items["" + string + ".orig"] = false; + $.get(items, function(items) { + if (!(items["" + string + ".orig"] && items.title === items["" + string])) { + return $.set("" + string + ".orig", items.title); + } + }); return this.textContent = this.innerHTML; }, blur: function() { $.set("" + g.BOARD + "." + this.className, this.textContent); - $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest); this.innerHTML = this.textContent; return this.contentEditable = false; } @@ -3761,15 +3773,20 @@ cachedTest = child.innerHTML; $.get("" + g.BOARD + "." + child.className, cachedTest, function(item) { + var title; + + if (!(title = item["" + g.BOARD + "." + child.className])) { + return; + } if (Conf['Persistent Custom Board Titles']) { - return child.innerHTML = item["" + g.BOARD + "." + child.className]; + return child.innerHTML = title; } else { return $.get("" + g.BOARD + "." + child.className + ".orig", cachedTest, function(itemb) { if (cachedTest === itemb["" + g.BOARD + "." + child.className + ".orig"]) { - return child.innerHTML = item["" + g.BOARD + "." + child.className]; + return child.innerHTML = title; } else { - $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest); - return $.set("" + g.BOARD + "." + child.className, cachedTest); + $.set("" + g.BOARD + "." + child.className, cachedTest); + return $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest); } }); } diff --git a/src/appchan.coffee b/src/appchan.coffee index b578b8713..c0757d02b 100644 --- a/src/appchan.coffee +++ b/src/appchan.coffee @@ -200,7 +200,7 @@ Style = icons = "data:image/png;base64,#{Icons[_conf["Icons"]]}" css = """<%= grunt.file.read('css/theme.css') %>""" - + <%= grunt.file.read('css/themeoptions.css') %> iconPositions: -> @@ -492,32 +492,41 @@ Banner = click: (e) -> if e.shiftKey @contentEditable = true - + keydown: (e) -> e.stopPropagation() - + focus: -> + string = "#{g.BOARD}.#{@className}" + items = + title: @innerHTML + items["#{string}"] = '' + items["#{string}.orig"] = false + + $.get items, (items) -> + unless items["#{string}.orig"] and items.title is items["#{string}"] + $.set "#{string}.orig", items.title @textContent = @innerHTML - + blur: -> $.set "#{g.BOARD}.#{@className}", @textContent - $.set "#{g.BOARD}.#{child.className}.orig", cachedTest @innerHTML = @textContent @contentEditable = false custom: (child) -> cachedTest = child.innerHTML - + $.get "#{g.BOARD}.#{child.className}", cachedTest, (item) -> + return unless title = item["#{g.BOARD}.#{child.className}"] if Conf['Persistent Custom Board Titles'] - child.innerHTML = item["#{g.BOARD}.#{child.className}"] + child.innerHTML = title else $.get "#{g.BOARD}.#{child.className}.orig", cachedTest, (itemb) -> if cachedTest is itemb["#{g.BOARD}.#{child.className}.orig"] - child.innerHTML = item["#{g.BOARD}.#{child.className}"] + child.innerHTML = title else - $.set "#{g.BOARD}.#{child.className}.orig", cachedTest $.set "#{g.BOARD}.#{child.className}", cachedTest + $.set "#{g.BOARD}.#{child.className}.orig", cachedTest $.on child, 'click', Banner.cb.click $.on child, 'keydown', Banner.cb.keydown