Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3

Fix some issues with previous merge.

Conflicts:
	CHANGELOG.md
	package.json
	src/General/Header.coffee
	src/Linkification/Linkify.coffee
This commit is contained in:
Zixaphir 2013-12-06 17:11:36 -07:00
commit adaa09aaaa
11 changed files with 51 additions and 53 deletions

View File

@ -1,6 +1,7 @@
**MayhemYDG**:
- Tiny posting cooldown adjustment:
- You can post an image reply immediately after a non-image reply.
- Fix 4chan X breaking in threads following a 4chan markup change.
- Minor cooldown fix:
- You cannot post an image reply immediately after a non-image reply anymore.
- **New option**: `Auto-hide header on scroll`.
- Added support for `4cdn.org`.
- More index navigation improvements:

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.43 - 2013-11-26
* 4chan X - Version 1.2.43 - 2013-12-06
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -22,7 +22,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.2.43 - 2013-11-26
* 4chan X - Version 1.2.43 - 2013-12-06
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -1064,20 +1064,18 @@
};
Post.prototype.parseFile = function(that) {
var alt, anchor, fileEl, fileInfo, size, thumb, unit;
var anchor, fileEl, fileText, nameNode, size, thumb, unit;
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
return;
}
alt = thumb.alt;
anchor = thumb.parentNode;
fileInfo = fileEl.firstElementChild;
fileText = fileEl.firstElementChild;
this.file = {
info: fileInfo,
text: fileInfo.firstElementChild,
text: fileText,
thumb: thumb,
URL: anchor.href,
size: alt.match(/[\d.]+\s\w+/)[0],
size: thumb.alt.match(/[\d.]+\s\w+/)[0],
MD5: thumb.dataset.md5,
isSpoiler: $.hasClass(anchor, 'imgspoiler')
};
@ -1088,9 +1086,9 @@
}
this.file.sizeInBytes = size;
this.file.thumbURL = that.isArchived ? thumb.src : "" + location.protocol + "//t.4cdn.org/" + this.board + "/thumb/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
this.file.name = $('span[title]', fileInfo).title;
this.file.name = (nameNode = $('span', fileText)) ? nameNode.title || nameNode.textContent : fileText.title;
if (this.file.isImage = /(jpg|png|gif)$/i.test(this.file.name)) {
return this.file.dimensions = this.file.text.textContent.match(/\d+x\d+/)[0];
return this.file.dimensions = fileText.textContent.match(/\d+x\d+/)[0];
}
};
@ -1270,8 +1268,7 @@
this.file[key] = val;
}
file = $('.file', post);
this.file.info = file.firstElementChild;
this.file.text = this.file.info.firstElementChild;
this.file.text = file.firstElementChild;
this.file.thumb = $('img[data-md5]', file);
this.file.fullImage = $('.full-image', file);
}
@ -1691,7 +1688,7 @@
bar: $.el('div', {
id: 'header-bar'
}),
notify: $.el('div', {
noticesRoot: $.el('div', {
id: 'notifications'
}),
shortcuts: $.el('span', {
@ -1719,7 +1716,7 @@
$.on(btn, 'click', Header.toggleBoardList);
$.rm($('#navtopright', fullBoardList));
$.add(boardList, fullBoardList);
$.add(Header.bar, [boardList, Header.shortcuts, Header.notify, Header.toggle]);
$.add(Header.bar, [boardList, Header.shortcuts, Header.noticesRoot, Header.toggle]);
Header.setCustomNav(Conf['Custom Board Navigation']);
Header.generateBoardList(Conf['boardnav'].replace(/(\r\n|\n|\r)/g, ' '));
$.sync('Custom Board Navigation', Header.setCustomNav);
@ -2785,8 +2782,8 @@
a.textContent = filename;
filename = a.innerHTML.replace(/'/g, ''');
fileDims = ext === 'pdf' ? 'PDF' : "" + file.width + "x" + file.height;
fileInfo = ("<span class=fileText id=fT" + postID + (file.isSpoiler ? " title='" + filename + "'" : '') + ">File: <a href='" + file.url + "' target=_blank>" + file.timestamp + "</a>") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", <span title='" + filename + "'>" + shortFilename + "</span>")) + ")</span>";
fileHTML = "<div id=f" + postID + " class=file><div class=fileInfo>" + fileInfo + "</div>" + imgSrc + "</div>";
fileInfo = ("<div class=fileText id=fT" + postID + (file.isSpoiler ? " title='" + filename + "'" : '') + ">File: <a href='" + file.url + "' target=_blank>" + file.timestamp + "</a>") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", <span" + (filename !== shortFilename ? " title='" + filename + "'" : '') + ">" + shortFilename + "</span>")) + ")</div>";
fileHTML = "<div class=file id=f" + postID + ">" + fileInfo + imgSrc + "</div>";
} else {
fileHTML = '';
}
@ -8260,7 +8257,7 @@
link = _ref[_i];
nodes.push($.tn('\u00A0'), link(this, Sauce.link.cloneNode(true)));
}
return $.add(this.file.info, nodes);
return $.add(this.file.text, nodes);
}
};

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.43 - 2013-11-26
* 4chan X - Version 1.2.43 - 2013-12-06
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -1071,20 +1071,18 @@
};
Post.prototype.parseFile = function(that) {
var alt, anchor, fileEl, fileInfo, size, thumb, unit;
var anchor, fileEl, fileText, nameNode, size, thumb, unit;
if (!((fileEl = $('.file', this.nodes.post)) && (thumb = $('img[data-md5]', fileEl)))) {
return;
}
alt = thumb.alt;
anchor = thumb.parentNode;
fileInfo = fileEl.firstElementChild;
fileText = fileEl.firstElementChild;
this.file = {
info: fileInfo,
text: fileInfo.firstElementChild,
text: fileText,
thumb: thumb,
URL: anchor.href,
size: alt.match(/[\d.]+\s\w+/)[0],
size: thumb.alt.match(/[\d.]+\s\w+/)[0],
MD5: thumb.dataset.md5,
isSpoiler: $.hasClass(anchor, 'imgspoiler')
};
@ -1095,10 +1093,10 @@
}
this.file.sizeInBytes = size;
this.file.thumbURL = that.isArchived ? thumb.src : "" + location.protocol + "//t.4cdn.org/" + this.board + "/thumb/" + (this.file.URL.match(/(\d+)\./)[1]) + "s.jpg";
this.file.name = $('span[title]', fileInfo).title;
this.file.name = (nameNode = $('span', fileText)) ? nameNode.title || nameNode.textContent : fileText.title;
this.file.name = this.file.name.replace(/%22/g, '"');
if (this.file.isImage = /(jpg|png|gif)$/i.test(this.file.name)) {
return this.file.dimensions = this.file.text.textContent.match(/\d+x\d+/)[0];
return this.file.dimensions = fileText.textContent.match(/\d+x\d+/)[0];
}
};
@ -1278,8 +1276,7 @@
this.file[key] = val;
}
file = $('.file', post);
this.file.info = file.firstElementChild;
this.file.text = this.file.info.firstElementChild;
this.file.text = file.firstElementChild;
this.file.thumb = $('img[data-md5]', file);
this.file.fullImage = $('.full-image', file);
}
@ -1703,7 +1700,7 @@
bar: $.el('div', {
id: 'header-bar'
}),
notify: $.el('div', {
noticesRoot: $.el('div', {
id: 'notifications'
}),
shortcuts: $.el('span', {
@ -1731,7 +1728,7 @@
$.on(btn, 'click', Header.toggleBoardList);
$.rm($('#navtopright', fullBoardList));
$.add(boardList, fullBoardList);
$.add(Header.bar, [boardList, Header.shortcuts, Header.notify, Header.toggle]);
$.add(Header.bar, [boardList, Header.shortcuts, Header.noticesRoot, Header.toggle]);
Header.setCustomNav(Conf['Custom Board Navigation']);
Header.generateBoardList(Conf['boardnav'].replace(/(\r\n|\n|\r)/g, ' '));
$.sync('Custom Board Navigation', Header.setCustomNav);
@ -2797,8 +2794,8 @@
a.textContent = filename;
filename = a.innerHTML.replace(/'/g, '&apos;');
fileDims = ext === 'pdf' ? 'PDF' : "" + file.width + "x" + file.height;
fileInfo = ("<span class=fileText id=fT" + postID + (file.isSpoiler ? " title='" + filename + "'" : '') + ">File: <a href='" + file.url + "' target=_blank>" + file.timestamp + "</a>") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", <span title='" + filename + "'>" + shortFilename + "</span>")) + ")</span>";
fileHTML = "<div id=f" + postID + " class=file><div class=fileInfo>" + fileInfo + "</div>" + imgSrc + "</div>";
fileInfo = ("<div class=fileText id=fT" + postID + (file.isSpoiler ? " title='" + filename + "'" : '') + ">File: <a href='" + file.url + "' target=_blank>" + file.timestamp + "</a>") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", <span" + (filename !== shortFilename ? " title='" + filename + "'" : '') + ">" + shortFilename + "</span>")) + ")</div>";
fileHTML = "<div class=file id=f" + postID + ">" + fileInfo + imgSrc + "</div>";
} else {
fileHTML = '';
}
@ -8245,7 +8242,7 @@
link = _ref[_i];
nodes.push($.tn('\u00A0'), link(this, Sauce.link.cloneNode(true)));
}
return $.add(this.file.info, nodes);
return $.add(this.file.text, nodes);
}
};

View File

@ -55,6 +55,9 @@ a[href="javascript:;"] {
.post {
overflow: visible !important;
}
.reply > .file > .fileText {
margin: 0 20px;
}
[hidden] {
display: none !important;
}

View File

@ -32,8 +32,8 @@
"http": true,
"https": true,
"software": "foolfuuka",
"boards": ["hr", "s4s", "tg", "tv", "x"],
"files": ["hr", "s4s", "tg", "tv", "x"]
"boards": ["hr", "pol", "s4s", "tg", "tv", "x"],
"files": ["hr", "pol", "s4s", "tg", "tv", "x"]
}, {
"uid": 4,
"name": "Nyafuu",

View File

@ -171,15 +171,15 @@ Build =
filename = a.innerHTML.replace /'/g, '&apos;'
fileDims = if ext is 'pdf' then 'PDF' else "#{file.width}x#{file.height}"
fileInfo = "<span class=fileText id=fT#{postID}#{if file.isSpoiler then " title='#{filename}'" else ''}>File: <a href='#{file.url}' target=_blank>#{file.timestamp}</a>" +
fileInfo = "<div class=fileText id=fT#{postID}#{if file.isSpoiler then " title='#{filename}'" else ''}>File: <a href='#{file.url}' target=_blank>#{file.timestamp}</a>" +
"-(#{fileSize}, #{fileDims}#{
if file.isSpoiler
''
else
", <span title='#{filename}'>#{shortFilename}</span>"
}" + ")</span>"
", <span#{if filename isnt shortFilename then " title='#{filename}'" else ''}>#{shortFilename}</span>"
}" + ")</div>"
fileHTML = "<div id=f#{postID} class=file><div class=fileInfo>#{fileInfo}</div>#{imgSrc}</div>"
fileHTML = "<div class=file id=f#{postID}>#{fileInfo}#{imgSrc}</div>"
else
fileHTML = ''

View File

@ -111,7 +111,7 @@ Header =
bar: $.el 'div',
id: 'header-bar'
notify: $.el 'div',
noticesRoot: $.el 'div',
id: 'notifications'
shortcuts: $.el 'span',
@ -136,7 +136,7 @@ Header =
$.rm $ '#navtopright', fullBoardList
$.add boardList, fullBoardList
$.add Header.bar, [boardList, Header.shortcuts, Header.notify, Header.toggle]
$.add Header.bar, [boardList, Header.shortcuts, Header.noticesRoot, Header.toggle]
Header.setCustomNav Conf['Custom Board Navigation']
Header.generateBoardList Conf['boardnav'].replace /(\r\n|\n|\r)/g, ' '

View File

@ -52,8 +52,7 @@ class Clone extends Post
for key, val of origin.file
@file[key] = val
file = $ '.file', post
@file.info = file.firstElementChild
@file.text = @file.info.firstElementChild
@file.text = file.firstElementChild
@file.thumb = $ 'img[data-md5]', file
@file.fullImage = $ '.full-image', file

View File

@ -117,15 +117,13 @@ class Post
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
# Supports JPG/PNG/GIF/PDF.
# Flash files are not supported.
alt = thumb.alt
anchor = thumb.parentNode
fileInfo = fileEl.firstElementChild
fileText = fileEl.firstElementChild
@file =
info: fileInfo
text: fileInfo.firstElementChild
text: fileText
thumb: thumb
URL: anchor.href
size: alt.match(/[\d.]+\s\w+/)[0]
size: thumb.alt.match(/[\d.]+\s\w+/)[0]
MD5: thumb.dataset.md5
isSpoiler: $.hasClass anchor, 'imgspoiler'
size = +@file.size.match(/[\d.]+/)[0]
@ -136,7 +134,10 @@ class Post
thumb.src
else
"#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
@file.name = $('span[title]', fileInfo).title
@file.name = if nameNode = $ 'span', fileText
nameNode.title or nameNode.textContent
else
fileText.title
<% if (type === 'crx') { %>
# replace %22 with quotes, see:
# crbug.com/81193
@ -146,7 +147,7 @@ class Post
@file.name = @file.name.replace /%22/g, '"'
<% } %>
if @file.isImage = /(jpg|png|gif)$/i.test @file.name
@file.dimensions = @file.text.textContent.match(/\d+x\d+/)[0]
@file.dimensions = fileText.textContent.match(/\d+x\d+/)[0]
kill: (file, now) ->
now or= new Date()

View File

@ -41,4 +41,4 @@ Sauce =
for link in Sauce.links
# \u00A0 is nbsp
nodes.push $.tn('\u00A0'), link @, Sauce.link.cloneNode true
$.add @file.info, nodes
$.add @file.text, nodes