diff --git a/src/General/Index.coffee b/src/General/Index.coffee index bbc0c929b..ea35d0ce4 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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() diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index d44fc01e8..0ced99216 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -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 diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index bc78d3e41..b10671f0b 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -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 @ diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index a2c20a85f..e91008683 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -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 diff --git a/src/platform/$.coffee b/src/platform/$.coffee index ea4394947..c3b873337 100644 --- a/src/platform/$.coffee +++ b/src/platform/$.coffee @@ -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?