Merge branch 'v3'

Conflicts:
	CHANGELOG.md
	builds/appchan-x.user.js
	builds/crx/script.js
	src/General/Config.coffee
	src/General/css/style.css
This commit is contained in:
Zixaphir 2013-08-16 03:39:33 -07:00
commit 298b5d3270
6 changed files with 1239 additions and 135 deletions

View File

@ -1,5 +1,21 @@
<<<<<<< HEAD
### v2.3.3 ### v2.3.3
*2013-08-16* *2013-08-16*
=======
**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
*2013-08-15*
>>>>>>> v3
**seaweedchan**: **seaweedchan**:
- Fix Color User IDs - Fix Color User IDs

View File

@ -11055,100 +11055,104 @@
}); });
}, },
ready: function() { ready: function() {
var banner, child, children, i, nodes, title; var banner, child, children, i, title;
banner = $(".boardBanner"); banner = $(".boardBanner");
title = $.el("div", { title = $.el("div", {
id: "boardTitle" id: "boardTitle"
}); });
children = banner.children; children = banner.children;
i = children.length; i = 0;
nodes = []; while (child = children[i++]) {
while (i--) { if (i === 1) {
child = children[i];
if (child.tagName.toLowerCase() === "img") {
child.id = "Banner"; child.id = "Banner";
child.title = "Click to change";
$.on(child, 'click', Banner.cb.toggle); $.on(child, 'click', Banner.cb.toggle);
continue; continue;
} }
if (Conf['Custom Board Titles']) { if (Conf['Custom Board Titles']) {
Banner.custom(child); Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title";
} }
nodes.push(child);
} }
$.add(title, nodes.reverse()); $.add(title, [children[1], children[2]]);
$.after(banner, title); $.after(banner, title);
}, },
types: {
jpg: 227,
png: 270,
gif: 253
},
cb: { cb: {
toggle: function() { toggle: function() {
var num, type; var num, type, types;
type = ['jpg', 'png', 'gif'][Math.floor(3 * Math.random())]; types = {
num = Math.floor(Banner.types[type] * Math.random()); jpg: 227,
png: 270,
gif: 253
};
type = Object.keys(types)[Math.floor(3 * Math.random())];
num = Math.floor(types[type] * Math.random());
return this.src = "//static.4chan.org/image/title/" + num + "." + type; return this.src = "//static.4chan.org/image/title/" + num + "." + type;
}, },
click: function(e) { click: function(e) {
if (e.shiftKey) { if (e.ctrlKey) {
return this.contentEditable = true; this.contentEditable = true;
return this.focus();
} }
}, },
keydown: function(e) { keydown: function(e) {
return e.stopPropagation(); e.stopPropagation();
if (!e.shiftKey && e.keyCode === 13) {
return this.blur();
}
}, },
focus: function() { focus: function() {
var items, string; var items, string, string2;
this.textContent = this.innerHTML;
string = "" + g.BOARD + "." + this.className; string = "" + g.BOARD + "." + this.className;
string2 = "" + string + ".orig";
items = { items = {
title: this.innerHTML title: this.innerHTML
}; };
items["" + string] = ''; items[string] = '';
items["" + string + ".orig"] = false; items[string2] = false;
$.get(items, function(items) { $.get(items, function(items) {
if (!(items["" + string + ".orig"] && items.title === items["" + string])) { if (!(items[string2] && items.title === items[string])) {
return $.set("" + string + ".orig", items.title); return $.set(string2, items.title);
} }
}); });
return this.textContent = this.innerHTML;
}, },
blur: function() { blur: function() {
$.set("" + g.BOARD + "." + this.className, this.textContent);
this.innerHTML = this.textContent; this.innerHTML = this.textContent;
return this.contentEditable = false; this.contentEditable = false;
return $.set("" + g.BOARD + "." + this.className, this.textContent);
} }
}, },
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;
var title; $.on(child, 'click keydown focus blur', function(e) {
return Banner.cb[e.type].apply(this, [e]);
});
$.get(string, cachedTest, function(item) {
var string2, 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 {
return $.get("" + g.BOARD + "." + child.className + ".orig", cachedTest, function(itemb) {
if (cachedTest === itemb["" + g.BOARD + "." + child.className + ".orig"]) {
return child.innerHTML = title;
} else {
$.set("" + g.BOARD + "." + child.className, cachedTest);
return $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest);
}
});
} }
string2 = "" + string + ".orig";
return $.get(string2, cachedTest, function(itemb) {
if (cachedTest === itemb[string2]) {
return child.innerHTML = title;
} else {
$.set(string, cachedTest);
return $.set(string2, cachedTest);
}
});
}); });
$.on(child, 'click', Banner.cb.click); return child;
$.on(child, 'keydown', Banner.cb.keydown);
$.on(child, 'focus', Banner.cb.focus);
return $.on(child, 'blur', Banner.cb.blur);
} }
}; };

View File

@ -11047,100 +11047,104 @@
}); });
}, },
ready: function() { ready: function() {
var banner, child, children, i, nodes, title; var banner, child, children, i, title;
banner = $(".boardBanner"); banner = $(".boardBanner");
title = $.el("div", { title = $.el("div", {
id: "boardTitle" id: "boardTitle"
}); });
children = banner.children; children = banner.children;
i = children.length; i = 0;
nodes = []; while (child = children[i++]) {
while (i--) { if (i === 1) {
child = children[i];
if (child.tagName.toLowerCase() === "img") {
child.id = "Banner"; child.id = "Banner";
child.title = "Click to change";
$.on(child, 'click', Banner.cb.toggle); $.on(child, 'click', Banner.cb.toggle);
continue; continue;
} }
if (Conf['Custom Board Titles']) { if (Conf['Custom Board Titles']) {
Banner.custom(child); Banner.custom(child).title = "Ctrl+click to edit board " + (i === 3 ? 'sub' : '') + "title";
} }
nodes.push(child);
} }
$.add(title, nodes.reverse()); $.add(title, [children[1], children[2]]);
$.after(banner, title); $.after(banner, title);
}, },
types: {
jpg: 227,
png: 270,
gif: 253
},
cb: { cb: {
toggle: function() { toggle: function() {
var num, type; var num, type, types;
type = ['jpg', 'png', 'gif'][Math.floor(3 * Math.random())]; types = {
num = Math.floor(Banner.types[type] * Math.random()); jpg: 227,
png: 270,
gif: 253
};
type = Object.keys(types)[Math.floor(3 * Math.random())];
num = Math.floor(types[type] * Math.random());
return this.src = "//static.4chan.org/image/title/" + num + "." + type; return this.src = "//static.4chan.org/image/title/" + num + "." + type;
}, },
click: function(e) { click: function(e) {
if (e.shiftKey) { if (e.ctrlKey) {
return this.contentEditable = true; this.contentEditable = true;
return this.focus();
} }
}, },
keydown: function(e) { keydown: function(e) {
return e.stopPropagation(); e.stopPropagation();
if (!e.shiftKey && e.keyCode === 13) {
return this.blur();
}
}, },
focus: function() { focus: function() {
var items, string; var items, string, string2;
this.textContent = this.innerHTML;
string = "" + g.BOARD + "." + this.className; string = "" + g.BOARD + "." + this.className;
string2 = "" + string + ".orig";
items = { items = {
title: this.innerHTML title: this.innerHTML
}; };
items["" + string] = ''; items[string] = '';
items["" + string + ".orig"] = false; items[string2] = false;
$.get(items, function(items) { $.get(items, function(items) {
if (!(items["" + string + ".orig"] && items.title === items["" + string])) { if (!(items[string2] && items.title === items[string])) {
return $.set("" + string + ".orig", items.title); return $.set(string2, items.title);
} }
}); });
return this.textContent = this.innerHTML;
}, },
blur: function() { blur: function() {
$.set("" + g.BOARD + "." + this.className, this.textContent);
this.innerHTML = this.textContent; this.innerHTML = this.textContent;
return this.contentEditable = false; this.contentEditable = false;
return $.set("" + g.BOARD + "." + this.className, this.textContent);
} }
}, },
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;
var title; $.on(child, 'click keydown focus blur', function(e) {
return Banner.cb[e.type].apply(this, [e]);
});
$.get(string, cachedTest, function(item) {
var string2, 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 {
return $.get("" + g.BOARD + "." + child.className + ".orig", cachedTest, function(itemb) {
if (cachedTest === itemb["" + g.BOARD + "." + child.className + ".orig"]) {
return child.innerHTML = title;
} else {
$.set("" + g.BOARD + "." + child.className, cachedTest);
return $.set("" + g.BOARD + "." + child.className + ".orig", cachedTest);
}
});
} }
string2 = "" + string + ".orig";
return $.get(string2, cachedTest, function(itemb) {
if (cachedTest === itemb[string2]) {
return child.innerHTML = title;
} else {
$.set(string, cachedTest);
return $.set(string2, cachedTest);
}
});
}); });
$.on(child, 'click', Banner.cb.click); return child;
$.on(child, 'keydown', Banner.cb.keydown);
$.on(child, 'focus', Banner.cb.focus);
return $.on(child, 'blur', Banner.cb.blur);
} }
}; };

1070
src/General/css/style.css Executable file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -7,76 +7,86 @@ Banner =
banner = $ ".boardBanner" banner = $ ".boardBanner"
title = $.el "div", title = $.el "div",
id: "boardTitle" id: "boardTitle"
children = banner.children {children} = banner
i = children.length
nodes = [] i = 0
while i-- while child = children[i++]
child = children[i] if i is 1
if child.tagName.toLowerCase() is "img" child.id = "Banner"
child.id = "Banner" child.title = "Click to change"
$.on child, 'click', Banner.cb.toggle $.on child, 'click', Banner.cb.toggle
continue continue
if Conf['Custom Board Titles'] if Conf['Custom Board Titles']
Banner.custom child Banner.custom(child).title = "Ctrl+click to edit board #{if i is 3
'sub'
else
''}title"
nodes.push child $.add title, [children[1], children[2]]
$.add title, nodes.reverse()
$.after banner, title $.after banner, title
return return
types:
jpg: 227
png: 270
gif: 253
cb: cb:
toggle: -> toggle: ->
type = ['jpg', 'png', 'gif'][Math.floor 3 * Math.random()] types =
num = Math.floor Banner.types[type] * Math.random() jpg: 227
png: 270
gif: 253
type = Object.keys(types)[Math.floor 3 * Math.random()]
num = Math.floor types[type] * Math.random()
@src = "//static.4chan.org/image/title/#{num}.#{type}" @src = "//static.4chan.org/image/title/#{num}.#{type}"
click: (e) -> click: (e) ->
if e.shiftKey if e.ctrlKey
@contentEditable = true @contentEditable = true
@focus()
keydown: (e) -> keydown: (e) ->
e.stopPropagation() e.stopPropagation()
return @blur() if !e.shiftKey and e.keyCode is 13
focus: -> 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 @textContent = @innerHTML
string = "#{g.BOARD}.#{@className}"
string2 = "#{string}.orig"
items = {title: @innerHTML}
items[string] = ''
items[string2] = false
$.get items, (items) ->
unless items[string2] and items.title is items[string]
$.set string2, items.title
return
blur: -> blur: ->
$.set "#{g.BOARD}.#{@className}", @textContent
@innerHTML = @textContent @innerHTML = @textContent
@contentEditable = false @contentEditable = false
$.set "#{g.BOARD}.#{@className}", @textContent
custom: (child) -> custom: (child) ->
cachedTest = child.innerHTML cachedTest = child.innerHTML
string = "#{g.BOARD}.#{child.className}"
$.get "#{g.BOARD}.#{child.className}", cachedTest, (item) -> $.on child, 'click keydown focus blur', (e) -> Banner.cb[e.type].apply @, [e]
return unless title = item["#{g.BOARD}.#{child.className}"]
if Conf['Persistent Custom Board Titles']
child.innerHTML = title
else
$.get "#{g.BOARD}.#{child.className}.orig", cachedTest, (itemb) ->
if cachedTest is itemb["#{g.BOARD}.#{child.className}.orig"]
child.innerHTML = title
else
$.set "#{g.BOARD}.#{child.className}", cachedTest
$.set "#{g.BOARD}.#{child.className}.orig", cachedTest
$.on child, 'click', Banner.cb.click $.get string, cachedTest, (item) ->
$.on child, 'keydown', Banner.cb.keydown return unless title = item[string]
$.on child, 'focus', Banner.cb.focus return child.innerHTML = title if Conf['Persistent Custom Board Titles']
$.on child, 'blur', Banner.cb.blur
string2 = "#{string}.orig"
$.get string2, cachedTest, (itemb) ->
if cachedTest is itemb[string2]
child.innerHTML = title
else
$.set string, cachedTest
$.set string2, cachedTest
child