diff --git a/LICENSE b/LICENSE index 671794a8b..0014fe8d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.9.43 - 2015-01-09 +* appchan x - Version 2.9.43 - 2015-01-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 1f66ee70a..8fdd5e184 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -27,7 +27,7 @@ // ==/UserScript== /* -* appchan x - Version 2.9.43 - 2015-01-09 +* appchan x - Version 2.9.43 - 2015-01-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -2707,7 +2707,6 @@ req.callbacks.push(cb); } return req; - return; } rm = function() { return delete reqs[url]; @@ -3180,8 +3179,8 @@ function Board(ID) { this.ID = ID; - this.threads = new SimpleDict; - this.posts = new SimpleDict; + this.threads = new SimpleDict(); + this.posts = new SimpleDict(); g.boards[this] = this; } @@ -3200,7 +3199,7 @@ this.ID = ID; this.board = board; this.fullID = "" + this.board + "." + this.ID; - this.posts = new SimpleDict; + this.posts = new SimpleDict(); this.isDead = false; this.isHidden = false; this.isOnTop = false; @@ -5945,7 +5944,7 @@ shortFilename: function(filename) { var ext, threshold; threshold = 30; - ext = filename.match(/\.[^.]+$/)[0]; + ext = filename.match(/\.?[^\.]*$/)[0]; if (filename.length - ext.length > threshold) { return "" + filename.slice(0, threshold - 5) + "(...)" + ext; } else { @@ -6010,7 +6009,6 @@ } else if (data.ext) { o.file = { name: (Build.unescape(data.filename)) + data.ext, - name: data.filename + data.ext, timestamp: "" + data.tim + data.ext, url: boardID === 'f' ? "//i.4cdn.org/" + boardID + "/" + (encodeURIComponent(data.filename)) + data.ext : "//i.4cdn.org/" + boardID + "/" + data.tim + data.ext, height: data.h, @@ -6049,7 +6047,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6058,14 +6056,16 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; + break; + case 'developer': capcodeClass = ' capcodeDeveloper'; capcodeStart = { innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: @@ -6147,21 +6147,43 @@ }; /* File Info */ - fileCont = (file != null ? file.isDeleted : void 0) ? { - innerHTML: "\"File" - } : file && boardID === 'f' ? { - innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" - } : file ? (file.isSpoiler ? (shortFilename = 'Spoiler Image', (spoilerRange = Build.spoilerRange[boardID]) ? fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png" : fileThumb = '//s.4cdn.org/image/spoiler.png', file.twidth = file.theight = 100) : (shortFilename = Build.shortFilename(file.name, !isOP), fileThumb = file.turl), fileSize = $.bytesToString(file.size), fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height, fileLink = file.isSpoiler || file.name === shortFilename ? { - innerHTML: "" + E(shortFilename) + "" - } : { - innerHTML: "" + E(shortFilename) + "" - }, fileText = file.isSpoiler ? { - innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" - } : { - innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" - }, { - innerHTML: fileText.innerHTML + "\""" - }) : void 0; + if (file != null ? file.isDeleted : void 0) { + fileCont = { + innerHTML: "\"File" + }; + } else if (file && boardID === 'f') { + fileCont = { + innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" + }; + } else if (file) { + if (file.isSpoiler) { + shortFilename = 'Spoiler Image'; + if (spoilerRange = Build.spoilerRange[boardID]) { + fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png"; + } else { + fileThumb = '//s.4cdn.org/image/spoiler.png'; + } + file.twidth = file.theight = 100; + } else { + shortFilename = Build.shortFilename(file.name, !isOP); + fileThumb = file.turl; + } + fileSize = $.bytesToString(file.size); + fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height; + fileLink = file.isSpoiler || file.name === shortFilename ? { + innerHTML: "" + E(shortFilename) + "" + } : { + innerHTML: "" + E(shortFilename) + "" + }; + fileText = file.isSpoiler ? { + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" + } : { + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" + }; + ({ + innerHTML: fileText.innerHTML + "\""" + }); + } fileBlock = file ? { innerHTML: "
" + fileCont.innerHTML + "
" } : { @@ -8421,7 +8443,7 @@ posts.forEach(QuoteThreading.insert); } else { nodes = []; - Unread.order = new RandomAccessList; + Unread.order = new RandomAccessList(); QuoteThreading.inserted = {}; posts.forEach(function(post) { if (post.isFetchedQuote) { @@ -14672,9 +14694,9 @@ this.hr = $.el('hr', { id: 'unread-line' }); - this.posts = new Set; - this.postsQuotingYou = new Set; - this.order = new RandomAccessList; + this.posts = new Set(); + this.postsQuotingYou = new Set(); + this.order = new RandomAccessList(); this.position = null; Thread.callbacks.push({ name: 'Unread', @@ -19761,8 +19783,8 @@ return Captcha.noscript.initFrame(); }); } - g.threads = new SimpleDict; - g.posts = new SimpleDict; + g.threads = new SimpleDict(); + g.posts = new SimpleDict(); pathname = location.pathname.split('/'); g.BOARD = new Board(pathname[1]); if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') { diff --git a/builds/crx/script.js b/builds/crx/script.js index 0149484cc..3563b931a 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.9.43 - 2015-01-09 +* appchan x - Version 2.9.43 - 2015-01-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -2679,7 +2679,6 @@ req.callbacks.push(cb); } return req; - return; } rm = function() { return delete reqs[url]; @@ -3206,8 +3205,8 @@ function Board(ID) { this.ID = ID; - this.threads = new SimpleDict; - this.posts = new SimpleDict; + this.threads = new SimpleDict(); + this.posts = new SimpleDict(); g.boards[this] = this; } @@ -3226,7 +3225,7 @@ this.ID = ID; this.board = board; this.fullID = "" + this.board + "." + this.ID; - this.posts = new SimpleDict; + this.posts = new SimpleDict(); this.isDead = false; this.isHidden = false; this.isOnTop = false; @@ -5974,7 +5973,7 @@ shortFilename: function(filename) { var ext, threshold; threshold = 30; - ext = filename.match(/\.[^.]+$/)[0]; + ext = filename.match(/\.?[^\.]*$/)[0]; if (filename.length - ext.length > threshold) { return "" + filename.slice(0, threshold - 5) + "(...)" + ext; } else { @@ -6039,7 +6038,6 @@ } else if (data.ext) { o.file = { name: (Build.unescape(data.filename)) + data.ext, - name: data.filename + data.ext, timestamp: "" + data.tim + data.ext, url: boardID === 'f' ? "//i.4cdn.org/" + boardID + "/" + (encodeURIComponent(data.filename)) + data.ext : "//i.4cdn.org/" + boardID + "/" + data.tim + data.ext, height: data.h, @@ -6078,7 +6076,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6087,14 +6085,16 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; + break; + case 'developer': capcodeClass = ' capcodeDeveloper'; capcodeStart = { innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: @@ -6176,21 +6176,43 @@ }; /* File Info */ - fileCont = (file != null ? file.isDeleted : void 0) ? { - innerHTML: "\"File" - } : file && boardID === 'f' ? { - innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" - } : file ? (file.isSpoiler ? (shortFilename = 'Spoiler Image', (spoilerRange = Build.spoilerRange[boardID]) ? fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png" : fileThumb = '//s.4cdn.org/image/spoiler.png', file.twidth = file.theight = 100) : (shortFilename = Build.shortFilename(file.name, !isOP), fileThumb = file.turl), fileSize = $.bytesToString(file.size), fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height, fileLink = file.isSpoiler || file.name === shortFilename ? { - innerHTML: "" + E(shortFilename) + "" - } : { - innerHTML: "" + E(shortFilename) + "" - }, fileText = file.isSpoiler ? { - innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" - } : { - innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" - }, { - innerHTML: fileText.innerHTML + "\""" - }) : void 0; + if (file != null ? file.isDeleted : void 0) { + fileCont = { + innerHTML: "\"File" + }; + } else if (file && boardID === 'f') { + fileCont = { + innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" + }; + } else if (file) { + if (file.isSpoiler) { + shortFilename = 'Spoiler Image'; + if (spoilerRange = Build.spoilerRange[boardID]) { + fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png"; + } else { + fileThumb = '//s.4cdn.org/image/spoiler.png'; + } + file.twidth = file.theight = 100; + } else { + shortFilename = Build.shortFilename(file.name, !isOP); + fileThumb = file.turl; + } + fileSize = $.bytesToString(file.size); + fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height; + fileLink = file.isSpoiler || file.name === shortFilename ? { + innerHTML: "" + E(shortFilename) + "" + } : { + innerHTML: "" + E(shortFilename) + "" + }; + fileText = file.isSpoiler ? { + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" + } : { + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" + }; + ({ + innerHTML: fileText.innerHTML + "\""" + }); + } fileBlock = file ? { innerHTML: "
" + fileCont.innerHTML + "
" } : { @@ -8466,7 +8488,7 @@ posts.forEach(QuoteThreading.insert); } else { nodes = []; - Unread.order = new RandomAccessList; + Unread.order = new RandomAccessList(); QuoteThreading.inserted = {}; posts.forEach(function(post) { if (post.isFetchedQuote) { @@ -14699,9 +14721,9 @@ this.hr = $.el('hr', { id: 'unread-line' }); - this.posts = new Set; - this.postsQuotingYou = new Set; - this.order = new RandomAccessList; + this.posts = new Set(); + this.postsQuotingYou = new Set(); + this.order = new RandomAccessList(); this.position = null; Thread.callbacks.push({ name: 'Unread', @@ -19790,8 +19812,8 @@ return Captcha.noscript.initFrame(); }); } - g.threads = new SimpleDict; - g.posts = new SimpleDict; + g.threads = new SimpleDict(); + g.posts = new SimpleDict(); pathname = location.pathname.split('/'); g.BOARD = new Board(pathname[1]); if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') { diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 839d8ef28..3175af075 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -8,7 +8,7 @@ Build = {'&': '&', ''': "'", '"': '"', '<': '<', '>': '>'}[c] shortFilename: (filename) -> threshold = 30 - ext = filename.match(/\.[^.]+$/)[0] + ext = filename.match(/\.?[^\.]*$/)[0] if filename.length - ext.length > threshold "#{filename[...threshold - 5]}(...)#{ext}" else @@ -33,24 +33,24 @@ Build = postFromObject: (data, boardID) -> o = # id - postID: data.no - threadID: data.resto or data.no - boardID: boardID + postID: data.no + threadID: data.resto or data.no + boardID: boardID # info - name: Build.unescape data.name - capcode: data.capcode - tripcode: data.trip - uniqueID: data.id - email: Build.unescape data.email - subject: Build.unescape data.sub - flagCode: data.country - flagName: Build.unescape data.country_name - date: data.now - dateUTC: data.time - comment: {innerHTML: data.com or ''} + name: Build.unescape data.name + capcode: data.capcode + tripcode: data.trip + uniqueID: data.id + email: Build.unescape data.email + subject: Build.unescape data.sub + flagCode: data.country + flagName: Build.unescape data.country_name + date: data.now + dateUTC: data.time + comment: {innerHTML: data.com or ''} # thread status - isSticky: !!data.sticky - isClosed: !!data.closed + isSticky: !!data.sticky + isClosed: !!data.closed isArchived: !!data.archived # file if data.filedeleted @@ -59,7 +59,6 @@ Build = else if data.ext o.file = name: (Build.unescape data.filename) + data.ext - name: data.filename + data.ext timestamp: "#{data.tim}#{data.ext}" url: if boardID is 'f' "//i.4cdn.org/#{boardID}/#{encodeURIComponent data.filename}#{data.ext}" @@ -98,14 +97,15 @@ Build = when 'admin', 'admin_highlight' capcodeClass = ' capcodeAdmin' capcodeStart = <%= html(' ## Admin') %> - capcodeIcon = <%= html(' Admin Icon') %> + capcodeIcon = <%= html(' Admin Icon') %> when 'mod' capcodeClass = ' capcodeMod' capcodeStart = <%= html(' ## Mod') %> - capcodeIcon = <%= html(' Mod Icon') %> + capcodeIcon = <%= html(' Mod Icon') %> + when 'developer' capcodeClass = ' capcodeDeveloper' capcodeStart = <%= html(' ## Developer') %> - capcodeIcon = <%= html(' Developer Icon') %> + capcodeIcon = <%= html(' Developer Icon') %> else capcodeClass = '' capcodeStart = <%= html('') %> @@ -181,14 +181,14 @@ Build = ### File Info ### - fileCont = if file?.isDeleted - <%= html( + if file?.isDeleted + fileCont = <%= html( '' + 'File deleted.' + '' ) %> else if file and boardID is 'f' - <%= html( + fileCont = <%= html( '
' + 'File: ${file.name}' + '-(${$.bytesToString(file.size)}, ${file.width}x${file.height}, ${file.tag})' + diff --git a/src/General/Main.coffee b/src/General/Main.coffee index d2b735c77..240463e59 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -3,8 +3,8 @@ Main = if location.hostname is 'www.google.com' return $.ready -> Captcha.noscript.initFrame() - g.threads = new SimpleDict - g.posts = new SimpleDict + g.threads = new SimpleDict() + g.posts = new SimpleDict() pathname = location.pathname.split '/' g.BOARD = new Board pathname[1] diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index aa99fb9a3..c60c99ece 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -70,7 +70,6 @@ do -> else req.callbacks.push cb return req - return rm = -> delete reqs[url] try return unless req = $.ajax url, options diff --git a/src/General/lib/board.class b/src/General/lib/board.class index 4b4fdd720..6dba99b94 100755 --- a/src/General/lib/board.class +++ b/src/General/lib/board.class @@ -2,7 +2,7 @@ class Board toString: -> @ID constructor: (@ID) -> - @threads = new SimpleDict - @posts = new SimpleDict + @threads = new SimpleDict() + @posts = new SimpleDict() g.boards[@] = @ \ No newline at end of file diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index 2f795b66e..ba61ccdc1 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -4,7 +4,7 @@ class Thread constructor: (@ID, @board) -> @fullID = "#{@board}.#{@ID}" - @posts = new SimpleDict + @posts = new SimpleDict() @isDead = false @isHidden = false @isOnTop = false diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 814776362..e1b26ddd1 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -12,9 +12,9 @@ Unread = @db = new DataBoard 'lastReadPosts', @sync @hr = $.el 'hr', id: 'unread-line' - @posts = new Set - @postsQuotingYou = new Set - @order = new RandomAccessList + @posts = new Set() + @postsQuotingYou = new Set() + @order = new RandomAccessList() @position = null Thread.callbacks.push diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 8c944dc52..b26fdc6af 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -105,7 +105,7 @@ QuoteThreading = posts.forEach QuoteThreading.insert else nodes = [] - Unread.order = new RandomAccessList + Unread.order = new RandomAccessList() QuoteThreading.inserted = {} posts.forEach (post) -> return if post.isFetchedQuote