Merge branch 'v3'

Conflicts:
	LICENSE
	builds/appchan-x.user.js
	builds/crx/script.js
This commit is contained in:
Zixaphir 2014-01-21 13:59:05 -07:00
commit f301f1c2c2
5 changed files with 57 additions and 91 deletions

View File

@ -1,5 +1,5 @@
/* /*
* appchan x - Version 2.8.7 - 2014-01-19 * appchan x - Version 2.8.7 - 2014-01-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -22,7 +22,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.8.7 - 2014-01-19 * appchan x - Version 2.8.7 - 2014-01-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -5515,32 +5515,19 @@
return Get.insert(post, root, context); return Get.insert(post, root, context);
}, },
parseMarkup: function(text) { parseMarkup: function(text) {
switch (text) { return {
case '\n': '\n': '<br>',
return '<br>'; '[b]': '<b>',
case '[b]': '[/b]': '</b>',
return '<b>'; '[spoiler]': '<s>',
case '[/b]': '[/spoiler]': '</s>',
return '</b>'; '[code]': '<pre class=prettyprint>',
case '[spoiler]': '[/code]': '</pre>',
return '<s>'; '[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">',
case '[/spoiler]': '[/moot]': '</div>',
return '</s>'; '[banned]': '<strong style="color: red;">',
case '[code]': '[/banned]': '</strong>'
return '<pre class=prettyprint>'; }[text] || text.replace(':lit', '');
case '[/code]':
return '</pre>';
case '[moot]':
return '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">';
case '[/moot]':
return '</div>';
case '[banned]':
return '<strong style="color: red;">';
case '[/banned]':
return '</strong>';
default:
return text.replace(':lit', '');
}
} }
}; };
@ -10169,9 +10156,9 @@
return ImageExpand.toggle(Get.postFromNode(this)); return ImageExpand.toggle(Get.postFromNode(this));
}, },
toggleAll: function() { toggleAll: function() {
var func; var func, toggle;
$.event('CloseMenu'); $.event('CloseMenu');
func = function(post) { toggle = function(post) {
var file; var file;
file = post.file; file = post.file;
if (!(file && file.isImage && doc.contains(post.nodes.root))) { if (!(file && file.isImage && doc.contains(post.nodes.root))) {
@ -10193,11 +10180,11 @@
} }
return g.posts.forEach(function(post) { return g.posts.forEach(function(post) {
var _i, _len, _ref; var _i, _len, _ref;
func(post); toggle(post);
_ref = post.clones; _ref = post.clones;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
post = _ref[_i]; post = _ref[_i];
func(post); toggle(post);
} }
}); });
}, },

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* appchan x - Version 2.8.7 - 2014-01-19 * appchan x - Version 2.8.7 - 2014-01-21
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -5525,32 +5525,19 @@
return Get.insert(post, root, context); return Get.insert(post, root, context);
}, },
parseMarkup: function(text) { parseMarkup: function(text) {
switch (text) { return {
case '\n': '\n': '<br>',
return '<br>'; '[b]': '<b>',
case '[b]': '[/b]': '</b>',
return '<b>'; '[spoiler]': '<s>',
case '[/b]': '[/spoiler]': '</s>',
return '</b>'; '[code]': '<pre class=prettyprint>',
case '[spoiler]': '[/code]': '</pre>',
return '<s>'; '[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">',
case '[/spoiler]': '[/moot]': '</div>',
return '</s>'; '[banned]': '<strong style="color: red;">',
case '[code]': '[/banned]': '</strong>'
return '<pre class=prettyprint>'; }[text] || text.replace(':lit', '');
case '[/code]':
return '</pre>';
case '[moot]':
return '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">';
case '[/moot]':
return '</div>';
case '[banned]':
return '<strong style="color: red;">';
case '[/banned]':
return '</strong>';
default:
return text.replace(':lit', '');
}
} }
}; };
@ -10152,9 +10139,9 @@
return ImageExpand.toggle(Get.postFromNode(this)); return ImageExpand.toggle(Get.postFromNode(this));
}, },
toggleAll: function() { toggleAll: function() {
var func; var func, toggle;
$.event('CloseMenu'); $.event('CloseMenu');
func = function(post) { toggle = function(post) {
var file; var file;
file = post.file; file = post.file;
if (!(file && file.isImage && doc.contains(post.nodes.root))) { if (!(file && file.isImage && doc.contains(post.nodes.root))) {
@ -10176,11 +10163,11 @@
} }
return g.posts.forEach(function(post) { return g.posts.forEach(function(post) {
var _i, _len, _ref; var _i, _len, _ref;
func(post); toggle(post);
_ref = post.clones; _ref = post.clones;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
post = _ref[_i]; post = _ref[_i];
func(post); toggle(post);
} }
}); });
}, },

View File

@ -215,28 +215,16 @@ Get =
Main.callbackNodes Post, [post] Main.callbackNodes Post, [post]
Get.insert post, root, context Get.insert post, root, context
parseMarkup: (text) -> parseMarkup: (text) ->
switch text {
when '\n' '\n': '<br>'
'<br>' '[b]': '<b>'
when '[b]' '[/b]': '</b>'
'<b>' '[spoiler]': '<s>'
when '[/b]' '[/spoiler]': '</s>'
'</b>' '[code]': '<pre class=prettyprint>'
when '[spoiler]' '[/code]': '</pre>'
'<s>' '[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">'
when '[/spoiler]' '[/moot]': '</div>'
'</s>' '[banned]': '<strong style="color: red;">'
when '[code]' '[/banned]': '</strong>'
'<pre class=prettyprint>' }[text] or text.replace ':lit', ''
when '[/code]'
'</pre>'
when '[moot]'
'<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">'
when '[/moot]'
'</div>'
when '[banned]'
'<strong style="color: red;">'
when '[/banned]'
'</strong>'
else
text.replace ':lit', ''

View File

@ -33,9 +33,10 @@ ImageExpand =
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
e.preventDefault() e.preventDefault()
ImageExpand.toggle Get.postFromNode @ ImageExpand.toggle Get.postFromNode @
toggleAll: -> toggleAll: ->
$.event 'CloseMenu' $.event 'CloseMenu'
func = (post) -> toggle = (post) ->
{file} = post {file} = post
return unless file and file.isImage and doc.contains post.nodes.root return unless file and file.isImage and doc.contains post.nodes.root
if ImageExpand.on and if ImageExpand.on and
@ -43,6 +44,7 @@ ImageExpand =
Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0) Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0)
return return
$.queueTask func, post $.queueTask func, post
if ImageExpand.on = $.hasClass ImageExpand.EAI, 'expand-all-shortcut' if ImageExpand.on = $.hasClass ImageExpand.EAI, 'expand-all-shortcut'
ImageExpand.EAI.className = 'contract-all-shortcut a-icon' ImageExpand.EAI.className = 'contract-all-shortcut a-icon'
ImageExpand.EAI.title = 'Contract All Images' ImageExpand.EAI.title = 'Contract All Images'
@ -51,10 +53,12 @@ ImageExpand =
ImageExpand.EAI.className = 'expand-all-shortcut a-icon' ImageExpand.EAI.className = 'expand-all-shortcut a-icon'
ImageExpand.EAI.title = 'Expand All Images' ImageExpand.EAI.title = 'Expand All Images'
func = ImageExpand.contract func = ImageExpand.contract
g.posts.forEach (post) -> g.posts.forEach (post) ->
func post toggle post
func post for post in post.clones toggle post for post in post.clones
return return
setFitness: -> setFitness: ->
(if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-' (if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-'