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
*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**:
- Fix Color User IDs

View File

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

View File

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

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