Move repeated code into $.modifiedClick.

This commit is contained in:
ccd0 2016-11-06 21:25:06 -08:00
parent 167f4e97ba
commit c2a2dafe7f
5 changed files with 7 additions and 4 deletions

View File

@ -297,7 +297,7 @@ Index =
Index.pageLoad()
pageNav: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
return if $.modifiedClick e
switch e.target.nodeName
when 'BUTTON'
e.target.blur()

View File

@ -41,7 +41,7 @@ ImageExpand =
cb:
toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
return if $.modifiedClick e
post = Get.postFromNode @
{file} = post
return if file.isExpanded and ImageCommon.onControls e

View File

@ -29,7 +29,7 @@ ExpandThread =
ExpandThread.setButton thread
cbToggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
return if $.modifiedClick e
e.preventDefault()
ExpandThread.toggle Get.threadFromNode @

View File

@ -30,7 +30,7 @@ QuoteInline =
href: link.href
toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
return if $.modifiedClick e
{boardID, threadID, postID} = Get.postDataFromLink @
return if Conf['Inline Cross-thread Quotes Only'] and g.VIEW is 'thread' and g.posts["#{boardID}.#{postID}"]?.nodes.root.offsetParent # exists and not hidden

View File

@ -254,6 +254,9 @@ do ->
root.dispatchEvent new CustomEvent event, {bubbles: true, detail: clone detail}
<% } %>
$.modifiedClick = (e) ->
e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
$.open =
<% if (type === 'userscript') { %>
if GM_openInTab?