From 6692dd329b256da528206c8a1e7611245c108bcf Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sat, 17 Aug 2013 05:41:27 -0700 Subject: [PATCH] And now that's gone. --- LICENSE | 10 ---------- builds/4chan-X.user.js | 14 +++----------- builds/crx/script.js | 14 +++----------- src/General/meta/banner.js | 10 ---------- src/Linkification/Linkify.coffee | 9 +++------ 5 files changed, 9 insertions(+), 48 deletions(-) diff --git a/LICENSE b/LICENSE index adf1a3246..4c4cb5ea6 100755 --- a/LICENSE +++ b/LICENSE @@ -77,14 +77,4 @@ * All rights reserved. * * license: https://github.com/4chan/4chan-JS/blob/master/LICENSE -* -* Linkify: (http://userscripts.org/scripts/show/1352) -* Copyright (c) 2011, Anthony Lieuallen -* All rights reserved. -* Originally written by Anthony Lieuallen of http://arantius.com/ -* Licensed for unlimited modification and redistribution as long as -* this notice is kept intact. -* -* license: http://userscripts.org/scripts/review/1352 -* */ \ No newline at end of file diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 607c84afc..2b86332be 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -97,16 +97,6 @@ * All rights reserved. * * license: https://github.com/4chan/4chan-JS/blob/master/LICENSE -* -* Linkify: (http://userscripts.org/scripts/show/1352) -* Copyright (c) 2011, Anthony Lieuallen -* All rights reserved. -* Originally written by Anthony Lieuallen of http://arantius.com/ -* Licensed for unlimited modification and redistribution as long as -* this notice is kept intact. -* -* license: http://userscripts.org/scripts/review/1352 -* */ 'use strict'; @@ -4548,7 +4538,9 @@ range.setEnd(range.endContainer, range.endOffset - i); } } - text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text; + if (!/(https?|mailto|git|magnet|ftp|irc):/.test(text)) { + text = (/@/.test(text) ? 'mailto:' : 'http://') + text; + } a = $.el('a', { className: 'linkify', rel: 'nofollow noreferrer', diff --git a/builds/crx/script.js b/builds/crx/script.js index b24cc2453..c835c0bd2 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -78,16 +78,6 @@ * All rights reserved. * * license: https://github.com/4chan/4chan-JS/blob/master/LICENSE -* -* Linkify: (http://userscripts.org/scripts/show/1352) -* Copyright (c) 2011, Anthony Lieuallen -* All rights reserved. -* Originally written by Anthony Lieuallen of http://arantius.com/ -* Licensed for unlimited modification and redistribution as long as -* this notice is kept intact. -* -* license: http://userscripts.org/scripts/review/1352 -* */ 'use strict'; @@ -4557,7 +4547,9 @@ range.setEnd(range.endContainer, range.endOffset - i); } } - text = text.contains(':') ? text : (text.contains('@') ? 'mailto:' : 'http://') + text; + if (!/(https?|mailto|git|magnet|ftp|irc):/.test(text)) { + text = (/@/.test(text) ? 'mailto:' : 'http://') + text; + } a = $.el('a', { className: 'linkify', rel: 'nofollow noreferrer', diff --git a/src/General/meta/banner.js b/src/General/meta/banner.js index ec6d6aa2b..c67cf4a7d 100755 --- a/src/General/meta/banner.js +++ b/src/General/meta/banner.js @@ -77,14 +77,4 @@ * All rights reserved. * * license: https://github.com/4chan/4chan-JS/blob/master/LICENSE -* -* Linkify: (http://userscripts.org/scripts/show/1352) -* Copyright (c) 2011, Anthony Lieuallen -* All rights reserved. -* Originally written by Anthony Lieuallen of http://arantius.com/ -* Licensed for unlimited modification and redistribution as long as -* this notice is kept intact. -* -* license: http://userscripts.org/scripts/review/1352 -* */ \ No newline at end of file diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index d0f1488ae..9bfb7e957 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -126,12 +126,9 @@ Linkify = if i range.setEnd range.endContainer, range.endOffset - i - # This is the only piece of code left based on Anthony Lieuallen's Linkify - text = - if text.contains ':' - text - else ( - if text.contains '@' + unless /(https?|mailto|git|magnet|ftp|irc):/.test text + text = ( + if /@/.test text 'mailto:' else 'http://'