diff --git a/4chan_x.user.js b/4chan_x.user.js index 9377dabf2..afcd6a4b1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -487,6 +487,15 @@ $.add(d.head, script); return $.rm(script); }, + shortenFilename: function(filename, isOP) { + var threshold; + threshold = 30 + 10 * isOP; + if (filename.replace(/\.\w+$/, '').length > threshold) { + return "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/)); + } else { + return filename; + } + }, bytesToString: function(size) { var unit; unit = 0; diff --git a/changelog b/changelog index 1770e9436..29f4de41b 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,25 @@ alpha - Mayhem Fix Chrome's install warning that 4chan X would execute on all domains. +2.34.7 +- Mayhem + Fix one-word-captcha, you'll need to leave a space for the fake word now. + +2.34.6 +- Mayhem + Fix error caused by change in 4chan's HTML about hidden filename in case of spoiler. + +2.34.5 +- Mayhem + Fix cooldown on /q/. + Fix thread creation with no file on /q/. + Fix 'Administrator/Moderator/Developer Replies' creating extra backlinks on /q/. + Add /mlp/ archive redirection. + +2.34.4 +- Mayhem + Add /q/ archive redirection. + 2.34.3 - Mayhem Update /k/ archive redirection. diff --git a/latest.js b/latest.js index ad1ae4685..5c611770a 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.3'},'*') \ No newline at end of file +postMessage({version:'2.34.7'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index ae5f139c0..0417e7b87 100644 --- a/script.coffee +++ b/script.coffee @@ -372,6 +372,15 @@ $.extend $, script = $.el 'script', textContent: code $.add d.head, script $.rm script + shortenFilename: (filename, isOP) -> + # FILENAME SHORTENING SCIENCE: + # OPs have a +10 characters threshold. + # The file extension is not taken into account. + threshold = 30 + 10 * isOP + if filename.replace(/\.\w+$/, '').length > threshold + "#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}" + else + filename bytesToString: (size) -> unit = 0 # Bytes while size >= 1024