CoffeeScript tricks.
This commit is contained in:
parent
84617ba149
commit
fec837ecdc
@ -1427,10 +1427,10 @@
|
|||||||
detail: {
|
detail: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
el: div,
|
el: div,
|
||||||
open: function(post) {
|
open: function(_arg) {
|
||||||
var thread;
|
var isReply, thread;
|
||||||
thread = post.thread;
|
thread = _arg.thread, isReply = _arg.isReply;
|
||||||
if (post.isReply || thread.isHidden) {
|
if (isReply || thread.isHidden) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ThreadHiding.menu.thread = thread;
|
ThreadHiding.menu.thread = thread;
|
||||||
@ -1924,10 +1924,12 @@
|
|||||||
};
|
};
|
||||||
fileEntry = {
|
fileEntry = {
|
||||||
el: fileEl,
|
el: fileEl,
|
||||||
open: function(post) {
|
open: function(_arg) {
|
||||||
|
var file;
|
||||||
|
file = _arg.file;
|
||||||
fileEl.textContent = 'File';
|
fileEl.textContent = 'File';
|
||||||
$.on(fileEl, 'click', DeleteLink["delete"]);
|
$.on(fileEl, 'click', DeleteLink["delete"]);
|
||||||
return !!post.file;
|
return !!file;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
d.dispatchEvent(new CustomEvent('AddMenuEntry', {
|
d.dispatchEvent(new CustomEvent('AddMenuEntry', {
|
||||||
@ -2047,12 +2049,14 @@
|
|||||||
detail: {
|
detail: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
el: a,
|
el: a,
|
||||||
open: function(post) {
|
open: function(_arg) {
|
||||||
if (!post.file) {
|
var file;
|
||||||
|
file = _arg.file;
|
||||||
|
if (!file) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
a.href = post.file.URL;
|
a.href = file.URL;
|
||||||
a.download = post.file.name;
|
a.download = file.name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2072,14 +2076,15 @@
|
|||||||
entry = {
|
entry = {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
el: div,
|
el: div,
|
||||||
open: function(post) {
|
open: function(_arg) {
|
||||||
var redirect;
|
var ID, board, redirect, thread;
|
||||||
|
ID = _arg.ID, thread = _arg.thread, board = _arg.board;
|
||||||
redirect = Redirect.to({
|
redirect = Redirect.to({
|
||||||
board: post.board,
|
board: board,
|
||||||
threadID: post.thread,
|
threadID: thread,
|
||||||
postID: post.ID
|
postID: ID
|
||||||
});
|
});
|
||||||
return redirect !== ("//boards.4chan.org/" + post.board + "/");
|
return redirect !== ("//boards.4chan.org/" + board + "/");
|
||||||
},
|
},
|
||||||
subEntries: []
|
subEntries: []
|
||||||
};
|
};
|
||||||
@ -2099,11 +2104,13 @@
|
|||||||
target: '_blank'
|
target: '_blank'
|
||||||
});
|
});
|
||||||
if (type === 'post') {
|
if (type === 'post') {
|
||||||
open = function(post) {
|
open = function(_arg) {
|
||||||
|
var ID, board, thread;
|
||||||
|
ID = _arg.ID, thread = _arg.thread, board = _arg.board;
|
||||||
el.href = Redirect.to({
|
el.href = Redirect.to({
|
||||||
board: post.board,
|
board: board,
|
||||||
threadID: post.thread,
|
threadID: thread,
|
||||||
postID: post.ID
|
postID: ID
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -485,13 +485,12 @@ ThreadHiding =
|
|||||||
detail:
|
detail:
|
||||||
type: 'post'
|
type: 'post'
|
||||||
el: div
|
el: div
|
||||||
open: (post) ->
|
open: ({thread, isReply}) ->
|
||||||
{thread} = post
|
if isReply or thread.isHidden
|
||||||
if post.isReply or thread.isHidden
|
|
||||||
return false
|
return false
|
||||||
ThreadHiding.menu.thread = thread
|
ThreadHiding.menu.thread = thread
|
||||||
true
|
true
|
||||||
subEntries: [{el: apply}, {el: makeStub}]
|
subEntries: [el: apply; el: makeStub]
|
||||||
hide: ->
|
hide: ->
|
||||||
makeStub = $('input', @parentNode).checked
|
makeStub = $('input', @parentNode).checked
|
||||||
{thread} = ThreadHiding.menu
|
{thread} = ThreadHiding.menu
|
||||||
@ -841,10 +840,10 @@ DeleteLink =
|
|||||||
true
|
true
|
||||||
fileEntry =
|
fileEntry =
|
||||||
el: fileEl
|
el: fileEl
|
||||||
open: (post) ->
|
open: ({file}) ->
|
||||||
fileEl.textContent = 'File'
|
fileEl.textContent = 'File'
|
||||||
$.on fileEl, 'click', DeleteLink.delete
|
$.on fileEl, 'click', DeleteLink.delete
|
||||||
!!post.file
|
!!file
|
||||||
|
|
||||||
d.dispatchEvent new CustomEvent 'AddMenuEntry',
|
d.dispatchEvent new CustomEvent 'AddMenuEntry',
|
||||||
detail:
|
detail:
|
||||||
@ -940,10 +939,10 @@ DownloadLink =
|
|||||||
detail:
|
detail:
|
||||||
type: 'post'
|
type: 'post'
|
||||||
el: a
|
el: a
|
||||||
open: (post) ->
|
open: ({file}) ->
|
||||||
return false unless post.file
|
return false unless file
|
||||||
a.href = post.file.URL
|
a.href = file.URL
|
||||||
a.download = post.file.name
|
a.download = file.name
|
||||||
true
|
true
|
||||||
|
|
||||||
ArchiveLink =
|
ArchiveLink =
|
||||||
@ -956,12 +955,12 @@ ArchiveLink =
|
|||||||
entry =
|
entry =
|
||||||
type: 'post'
|
type: 'post'
|
||||||
el: div
|
el: div
|
||||||
open: (post) ->
|
open: ({ID, thread, board}) ->
|
||||||
redirect = Redirect.to
|
redirect = Redirect.to
|
||||||
board: post.board
|
board: board
|
||||||
threadID: post.thread
|
threadID: thread
|
||||||
postID: post.ID
|
postID: ID
|
||||||
redirect isnt "//boards.4chan.org/#{post.board}/"
|
redirect isnt "//boards.4chan.org/#{board}/"
|
||||||
subEntries: []
|
subEntries: []
|
||||||
|
|
||||||
for type in [
|
for type in [
|
||||||
@ -985,11 +984,11 @@ ArchiveLink =
|
|||||||
target: '_blank'
|
target: '_blank'
|
||||||
|
|
||||||
if type is 'post'
|
if type is 'post'
|
||||||
open = (post) ->
|
open = ({ID, thread, board}) ->
|
||||||
el.href = Redirect.to
|
el.href = Redirect.to
|
||||||
board: post.board
|
board: board
|
||||||
threadID: post.thread
|
threadID: thread
|
||||||
postID: post.ID
|
postID: ID
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
open = (post) ->
|
open = (post) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user