diff --git a/CHANGELOG.md b/CHANGELOG.md index db7433a73..69f7f186d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/LICENSE b/LICENSE index caa85caeb..589a954f7 100755 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 0eb7de8e8..163e3f2f3 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -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 = ("File: " + file.timestamp + "") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", " + shortFilename + "")) + ")"; - fileHTML = "
" + fileInfo + "
" + imgSrc + "
"; + fileInfo = ("
File: " + file.timestamp + "") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", " + shortFilename + "")) + ")
"; + fileHTML = "
" + fileInfo + imgSrc + "
"; } 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); } }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 4bd7d8622..3e67fe1ab 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -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, '''); fileDims = ext === 'pdf' ? 'PDF' : "" + file.width + "x" + file.height; - fileInfo = ("File: " + file.timestamp + "") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", " + shortFilename + "")) + ")"; - fileHTML = "
" + fileInfo + "
" + imgSrc + "
"; + fileInfo = ("
File: " + file.timestamp + "") + ("-(" + fileSize + ", " + fileDims + (file.isSpoiler ? '' : ", " + shortFilename + "")) + ")
"; + fileHTML = "
" + fileInfo + imgSrc + "
"; } 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); } }; diff --git a/css/style.css b/css/style.css index 278565f97..4d4347ff1 100644 --- a/css/style.css +++ b/css/style.css @@ -55,6 +55,9 @@ a[href="javascript:;"] { .post { overflow: visible !important; } +.reply > .file > .fileText { + margin: 0 20px; +} [hidden] { display: none !important; } diff --git a/json/archives.json b/json/archives.json index 3cf455d73..435f105b9 100644 --- a/json/archives.json +++ b/json/archives.json @@ -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", diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 900b5b0dc..42dc76b6a 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -171,15 +171,15 @@ Build = filename = a.innerHTML.replace /'/g, ''' fileDims = if ext is 'pdf' then 'PDF' else "#{file.width}x#{file.height}" - fileInfo = "File: #{file.timestamp}" + + fileInfo = "
File: #{file.timestamp}" + "-(#{fileSize}, #{fileDims}#{ if file.isSpoiler '' else - ", #{shortFilename}" - }" + ")" + ", #{shortFilename}" + }" + ")
" - fileHTML = "
#{fileInfo}
#{imgSrc}
" + fileHTML = "
#{fileInfo}#{imgSrc}
" else fileHTML = '' diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 1bd0ea9f9..288c43dea 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -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, ' ' diff --git a/src/General/lib/clone.class b/src/General/lib/clone.class index 547afe1db..df724e6b9 100755 --- a/src/General/lib/clone.class +++ b/src/General/lib/clone.class @@ -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 diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 860e1430c..a77a978c5 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -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() diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index d182615bc..e230b3c3b 100755 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -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