From f1c2ca46919d3c65bfec976716060cd687b9e79f Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Fri, 10 May 2013 03:25:25 -0700 Subject: [PATCH] External links --- builds/4chan-X.js | 13 +++++++++++-- builds/4chan-X.user.js | 13 +++++++++++-- builds/crx/script.js | 13 +++++++++++-- src/General/Header.coffee | 9 ++++++++- src/General/html/Settings/Advanced.html | 1 + 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 19083374e..0936d13f0 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -1592,7 +1592,7 @@ return; } as = $$('#full-board-list a', Header.bar); - nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { + nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { var a, board, m, _i, _len; if (/^[^\w@]/.test(t)) { @@ -1607,6 +1607,15 @@ $.on(a, 'click', Header.toggleBoardList); return a; } + if (/^external/.test(t)) { + a = $.el('a', { + href: (t.match(/-url:"(.+)"/) || [null, '+'])[1], + textContent: (t.match(/-text:"(.+)"-/) || [null, '+'])[1], + className: 'external', + target: '_blank' + }); + return a; + } board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0]; for (_i = 0, _len = as.length; _i < _len; _i++) { a = as[_i]; @@ -9715,7 +9724,7 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, ta, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
External link: external-text:\"Google\"-url:\"http://www.google.com\"
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index fd8e648c0..6211ed016 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1588,7 +1588,7 @@ return; } as = $$('#full-board-list a', Header.bar); - nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { + nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { var a, board, m, _i, _len; if (/^[^\w@]/.test(t)) { @@ -1603,6 +1603,15 @@ $.on(a, 'click', Header.toggleBoardList); return a; } + if (/^external/.test(t)) { + a = $.el('a', { + href: (t.match(/-url:"(.+)"/) || [null, '+'])[1], + textContent: (t.match(/-text:"(.+)"-/) || [null, '+'])[1], + className: 'external', + target: '_blank' + }); + return a; + } board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0]; for (_i = 0, _len = as.length; _i < _len; _i++) { a = as[_i]; @@ -9726,7 +9735,7 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, ta, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
External link: external-text:\"Google\"-url:\"http://www.google.com\"
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; diff --git a/builds/crx/script.js b/builds/crx/script.js index bdf79efa3..0d1eadd8a 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1590,7 +1590,7 @@ return; } as = $$('#full-board-list a', Header.bar); - nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { + nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+"))*|[^\w@]+/g).map(function(t) { var a, board, m, _i, _len; if (/^[^\w@]/.test(t)) { @@ -1605,6 +1605,15 @@ $.on(a, 'click', Header.toggleBoardList); return a; } + if (/^external/.test(t)) { + a = $.el('a', { + href: (t.match(/-url:"(.+)"/) || [null, '+'])[1], + textContent: (t.match(/-text:"(.+)"-/) || [null, '+'])[1], + className: 'external', + target: '_blank' + }); + return a; + } board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0]; for (_i = 0, _len = as.length; _i < _len; _i++) { a = as[_i]; @@ -9707,7 +9716,7 @@ advanced: function(section) { var archiver, event, input, inputs, items, name, ta, toSelect, _i, _j, _len, _len1, _ref; - section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; + section.innerHTML = "
Archiver\nSelect an Archiver for this board:\n
Custom Board Navigation
In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Status/Twitter link (status, @).
\n For example:
[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:\"Piracy\"]
\n will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
\n if you are on /g/.\n
Board link: board
Title link: board-title
Board link (Replace with title when on that board): board-replace
Full text link: board-full
Custom text link: board-text:\"VIP Board\"
Index-only link: board-index
Catalog-only link: board-catalog
External link: external-text:\"Google\"-url:\"http://www.google.com\"
Combinations are possible: board-index-text:\"VIP Index\"
Full board list toggle: toggle-all
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Quick Reply Personas is disabled.

\n One item per line.
\n Items will be added in the relevant input's auto-completion list.
\n Password items will always be used, since there is no password input.
\n Lines starting with a # will be ignored.\n

Unread Favicon is disabled.
Emoji is disabled.
\n Sage Icon:
\n Position:
Thread Updater is disabled.
\n Interval:
"; items = {}; inputs = {}; _ref = ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 6603c3d8a..ff2a55be7 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -132,7 +132,7 @@ Header = $.rmAll list return unless text as = $$('#full-board-list a', Header.bar) - nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map (t) -> + nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+"))*|[^\w@]+/g).map (t) -> if /^[^\w@]/.test t return $.tn t if /^toggle-all/.test t @@ -142,6 +142,13 @@ Header = href: 'javascript:;' $.on a, 'click', Header.toggleBoardList return a + if /^external/.test t + a = $.el 'a', + href: (t.match(/-url:"(.+)"/) || [null, '+'])[1] + textContent: (t.match(/-text:"(.+)"-/) || [null, '+'])[1] + className: 'external' + target: '_blank' + return a board = if /^current/.test t g.BOARD.ID else diff --git a/src/General/html/Settings/Advanced.html b/src/General/html/Settings/Advanced.html index 0f41d75ed..99bb1f3c5 100644 --- a/src/General/html/Settings/Advanced.html +++ b/src/General/html/Settings/Advanced.html @@ -21,6 +21,7 @@
Custom text link: board-text:"VIP Board"
Index-only link: board-index
Catalog-only link: board-catalog
+
External link: external-text:"Google"-url:"http://www.google.com"
Combinations are possible: board-index-text:"VIP Index"
Full board list toggle: toggle-all