More optimizations + changelog

This commit is contained in:
seaweedchan 2013-08-16 02:24:24 -07:00
parent 15db317896
commit 109699d83a
5 changed files with 53 additions and 44 deletions

View File

@ -1,3 +1,14 @@
**seaweedchan**:
![Board title editing in action](src/General/img/changelog/1.2.31.png)
- Ported `Custom Board Titles` feature from Appchan X (with Zixaphir)
- This allows you to edit the board title and subtitle in real-time by ctrl+clicking them
- Ported ability to change to a new random banner image on click from Appchan X
**Zixaphir**:
- Small linkifier fix
### v1.2.30 ### v1.2.30
*2013-08-15* *2013-08-15*

View File

@ -8517,11 +8517,11 @@
items = { items = {
title: this.innerHTML title: this.innerHTML
}; };
items["" + string] = ''; items[string] = '';
items["" + string + ".orig"] = false; items[string.orig] = false;
$.get(items, function(items) { $.get(items, function(items) {
if (!(items["" + string + ".orig"] && items.title === items["" + string])) { if (!(items[string.orig] && items.title === items[string])) {
return $.set("" + string + ".orig", items.title); return $.set(string.orig, items.title);
} }
}); });
return this.textContent = this.innerHTML; return this.textContent = this.innerHTML;
@ -8533,30 +8533,30 @@
} }
}, },
custom: function(child) { custom: function(child) {
var cachedTest; var cachedTest, string;
cachedTest = child.innerHTML; cachedTest = child.innerHTML;
$.get("" + g.BOARD + "." + child.className, cachedTest, function(item) { string = "" + g.BOARD + "." + child.className;
$.get(string, cachedTest, function(item) {
var title; var title;
if (!(title = item["" + g.BOARD + "." + child.className])) { if (!(title = item[string])) {
return; return;
} }
if (Conf['Persistent Custom Board Titles']) { if (Conf['Persistent Custom Board Titles']) {
return child.innerHTML = title; return child.innerHTML = title;
} else { } else {
return $.get("" + g.BOARD + "." + child.className + ".orig", cachedTest, function(itemb) { return $.get(string.org, cachedTest, function(itemb) {
if (cachedTest === itemb["" + g.BOARD + "." + child.className + ".orig"]) { if (cachedTest === itemb[string.orig]) {
return child.innerHTML = title; return child.innerHTML = title;
} else { } else {
$.set("" + g.BOARD + "." + child.className, cachedTest); $.set(string, cachedTest);
return $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest); return $.set(string.orig, cachedTest);
} }
}); });
} }
}); });
$.on(child, 'click', Banner.cb.click); return $.on(child, 'click keydown focus blur', function(e) {
$.on(child, 'keydown', Banner.cb.keydown); return Banner.cb[e.type].call(this);
$.on(child, 'focus', Banner.cb.focus); });
return $.on(child, 'blur', Banner.cb.blur);
} }
}; };

View File

@ -8507,11 +8507,11 @@
items = { items = {
title: this.innerHTML title: this.innerHTML
}; };
items["" + string] = ''; items[string] = '';
items["" + string + ".orig"] = false; items[string.orig] = false;
$.get(items, function(items) { $.get(items, function(items) {
if (!(items["" + string + ".orig"] && items.title === items["" + string])) { if (!(items[string.orig] && items.title === items[string])) {
return $.set("" + string + ".orig", items.title); return $.set(string.orig, items.title);
} }
}); });
return this.textContent = this.innerHTML; return this.textContent = this.innerHTML;
@ -8523,30 +8523,30 @@
} }
}, },
custom: function(child) { custom: function(child) {
var cachedTest; var cachedTest, string;
cachedTest = child.innerHTML; cachedTest = child.innerHTML;
$.get("" + g.BOARD + "." + child.className, cachedTest, function(item) { string = "" + g.BOARD + "." + child.className;
$.get(string, cachedTest, function(item) {
var title; var title;
if (!(title = item["" + g.BOARD + "." + child.className])) { if (!(title = item[string])) {
return; return;
} }
if (Conf['Persistent Custom Board Titles']) { if (Conf['Persistent Custom Board Titles']) {
return child.innerHTML = title; return child.innerHTML = title;
} else { } else {
return $.get("" + g.BOARD + "." + child.className + ".orig", cachedTest, function(itemb) { return $.get(string.org, cachedTest, function(itemb) {
if (cachedTest === itemb["" + g.BOARD + "." + child.className + ".orig"]) { if (cachedTest === itemb[string.orig]) {
return child.innerHTML = title; return child.innerHTML = title;
} else { } else {
$.set("" + g.BOARD + "." + child.className, cachedTest); $.set(string, cachedTest);
return $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest); return $.set(string.orig, cachedTest);
} }
}); });
} }
}); });
$.on(child, 'click', Banner.cb.click); return $.on(child, 'click keydown focus blur', function(e) {
$.on(child, 'keydown', Banner.cb.keydown); return Banner.cb[e.type].call(this);
$.on(child, 'focus', Banner.cb.focus); });
return $.on(child, 'blur', Banner.cb.blur);
} }
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -49,12 +49,12 @@ Banner =
string = "#{g.BOARD}.#{@className}" string = "#{g.BOARD}.#{@className}"
items = items =
title: @innerHTML title: @innerHTML
items["#{string}"] = '' items[string] = ''
items["#{string}.orig"] = false items[string.orig] = false
$.get items, (items) -> $.get items, (items) ->
unless items["#{string}.orig"] and items.title is items["#{string}"] unless items[string.orig] and items.title is items[string]
$.set "#{string}.orig", items.title $.set string.orig, items.title
@textContent = @innerHTML @textContent = @innerHTML
blur: -> blur: ->
@ -64,20 +64,18 @@ Banner =
custom: (child) -> custom: (child) ->
cachedTest = child.innerHTML cachedTest = child.innerHTML
string = "#{g.BOARD}.#{child.className}"
$.get "#{g.BOARD}.#{child.className}", cachedTest, (item) -> $.get string, cachedTest, (item) ->
return unless title = item["#{g.BOARD}.#{child.className}"] return unless title = item[string]
if Conf['Persistent Custom Board Titles'] if Conf['Persistent Custom Board Titles']
child.innerHTML = title child.innerHTML = title
else else
$.get "#{g.BOARD}.#{child.className}.orig", cachedTest, (itemb) -> $.get string.org, cachedTest, (itemb) ->
if cachedTest is itemb["#{g.BOARD}.#{child.className}.orig"] if cachedTest is itemb[string.orig]
child.innerHTML = title child.innerHTML = title
else else
$.set "#{g.BOARD}.#{child.className}", cachedTest $.set string, cachedTest
$.set "#{g.BOARD}.#{child.className}.orig", cachedTest $.set string.orig, cachedTest
$.on child, 'click', Banner.cb.click $.on child, 'click keydown focus blur', (e) -> Banner.cb[e.type].call @
$.on child, 'keydown', Banner.cb.keydown
$.on child, 'focus', Banner.cb.focus
$.on child, 'blur', Banner.cb.blur