summaryrefslogtreecommitdiff
path: root/Data/BuiltIn/Libraries/lua-addons/addons/linker
diff options
context:
space:
mode:
Diffstat (limited to 'Data/BuiltIn/Libraries/lua-addons/addons/linker')
-rw-r--r--Data/BuiltIn/Libraries/lua-addons/addons/linker/data/settings.xml59
-rw-r--r--Data/BuiltIn/Libraries/lua-addons/addons/linker/linker.lua76
-rw-r--r--Data/BuiltIn/Libraries/lua-addons/addons/linker/readme.md28
3 files changed, 163 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/linker/data/settings.xml b/Data/BuiltIn/Libraries/lua-addons/addons/linker/data/settings.xml
new file mode 100644
index 0000000..ec3209e
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lua-addons/addons/linker/data/settings.xml
@@ -0,0 +1,59 @@
+<?xml version="1.1" ?>
+<settings>
+ <!--
+ URL settings for Linker. If you want to add a site to open without a
+ search feature, add a new DOM node under the <raw> tag:
+
+ <command>url</command>
+
+ Once you do and reload Linker, you will be able to open the URL
+ provided by typing the following Windower command:
+
+ web command
+
+ If you want the site to be searchable, you need to define a searchable
+ URL under the <search> section, with the search keyword replaced with
+ ${query}. Once you do that and restart Linker, you can search as
+ follows:
+
+ web command query
+
+ "query" is the search term. It supports all of the features the
+ regular search of that site provides. For example, searching on FFXIDB
+ allows for wildcards, meaning you can search for "Estoq*body" and it
+ will find "Estoqueur's seal: body". This means that you can also do
+ that in the chat log:
+
+ web db estoq*body
+
+ That command will bring you to this page: http://ffxidb.com/items/3134
+
+ Note when adding new URLs:
+ Remember to replace & in URLs with &amp; to be XML-comform.
+ -->
+ <global>
+ <raw>
+ <ah>http://ffxiah.com/</ah>
+ <ahf>http://www.ffxiah.com/forum</ahf>
+ <bg>http://wiki.bluegartr.com/bg/Main_Page</bg>
+ <bgf>http://www.bluegartr.com/forum.php</bgf>
+ <db>http://ffxidb.com/</db>
+ <g>http://google.com</g>
+ <ge>http://ffxi.gamerescape.com/wiki/Main_Page</ge>
+ <gw>http://guildwork.com</gw>
+ <of>http://forum.square-enix.com/ffxi/forum.php</of>
+ <wa>http://wolframalpha.com</wa>
+ <wikia>http://wiki.ffxiclopedia.org/wiki/Main_Page</wikia>
+ <win>http://windower.net</win>
+ </raw>
+ <search>
+ <ah>http://ffxiah.com/search/item?q=${query}</ah>
+ <bg>http://wiki.bluegartr.com/index.php?title=Special:Search&amp;search=${query}</bg>
+ <db>http://ffxidb.com/search?q=${query}</db>
+ <g>http://google.com/?q=${query}</g>
+ <ge>http://ffxi.gamerescape.com/wiki/Special:Search?search=${query}</ge>
+ <wa>http://wolframalpha.com/?i=${query}</wa>
+ <wikia>http://wiki.ffxiclopedia.org/wiki/index.php?search=${query}&amp;fulltext=Search</wikia>
+ </search>
+ </global>
+</settings>
diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/linker/linker.lua b/Data/BuiltIn/Libraries/lua-addons/addons/linker/linker.lua
new file mode 100644
index 0000000..13e6d40
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lua-addons/addons/linker/linker.lua
@@ -0,0 +1,76 @@
+require('luau')
+local url = require('socket.url')
+
+_addon.name = 'Linker'
+_addon.author = 'Arcon'
+_addon.version = '1.1.0.0'
+_addon.command = 'linker'
+_addon.commands = {'web'}
+_addon.language = 'English'
+
+defaults = {}
+defaults.raw = {}
+
+-- FFXI info sites
+defaults.raw.db = 'http://ffxidb.com/'
+defaults.raw.ah = 'http://ffxiah.com/'
+defaults.raw.bg = 'http://wiki.bluegartr.com/bg/Main_Page'
+defaults.raw.ge = 'http://ffxi.gamerescape.com/wiki/Main_Page'
+defaults.raw.wikia = 'http://wiki.ffxiclopedia.org/wiki/Main_Page'
+
+-- FFXI community sites
+defaults.raw.of = 'http://forum.square-enix.com/ffxi/forum.php'
+defaults.raw.bgf = 'http://www.bluegartr.com/forum.php'
+defaults.raw.ahf = 'http://www.ffxiah.com/forum'
+defaults.raw.gw = 'http://guildwork.com/'
+
+-- Windower
+defaults.raw.win = 'http://windower.net/'
+defaults.raw.winf = 'http://forums.windower.net/'
+defaults.raw.winw = 'http://wiki.windower.net/'
+
+-- Miscallenous sites
+defaults.raw.g = 'http://google.com/'
+defaults.raw.wa = 'http://wolframalpha.com/'
+
+defaults.search = {}
+
+-- FFXI info sites
+defaults.search.db = 'http://ffxidb.com/search?q=${query}'
+defaults.search.ah = 'http://ffxiah.com/search/item?q=${query}'
+defaults.search.bg = 'http://wiki.bluegartr.com/index.php?title=Special:Search&search=${query}'
+defaults.search.ge = 'http://ffxi.gamerescape.com/wiki/Special:Search?search=${query}'
+defaults.search.wikia = 'https://ffxiclopedia.fandom.com/wiki/Special:Search?query=${query}'
+
+-- Miscallenous sites
+defaults.search.g = 'http://google.com/?q=${query}'
+defaults.search.wa = 'http://wolframalpha.com/?i=${query}'
+
+settings = config.load(defaults)
+
+-- Interpreter
+
+windower.register_event('addon command', function(command, ...)
+ if not ... or not settings.search[command] and settings.raw[command] then
+ windower.open_url(settings.raw[command])
+ elseif settings.search[command] then
+ local query_string = url.escape(L{...}:concat(' '))
+ local adjusted_query_string = query_string:gsub('%%', '%%%%')
+ windower.open_url((settings.search[command]:gsub('${query}', adjusted_query_string)))
+ else
+ error('Command "' .. command .. '" not found.')
+ end
+end)
+
+--[[
+Copyright (c) 2013-2014, Windower
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of Windower nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Windower BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+]]
diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/linker/readme.md b/Data/BuiltIn/Libraries/lua-addons/addons/linker/readme.md
new file mode 100644
index 0000000..76d8393
--- /dev/null
+++ b/Data/BuiltIn/Libraries/lua-addons/addons/linker/readme.md
@@ -0,0 +1,28 @@
+# Linker
+
+Opens certain links via simple console commands, with an optional search string. If the search string is omitted, the home page of that site will open.
+
+## Commands
+
+#### FFXI info sites:
+```
+//web db [query] # FFXIDB
+//web ah [query] # FFXIAH
+//web bg [query] # BlueGartr Wiki
+//web ge [query] # GamerEscape Wiki
+//web wikia [query] # FFXIclopedia
+```
+
+#### FFXI community sites
+```
+//web of # Official forums
+//web bgf # BlueGartr forums
+//web ahf # FFXIAH forums
+//web gw # Guildwork.com
+```
+
+#### Miscellanous sites
+```
+//web g [query] # Google
+//web wa [query] # Wolfram|Alpha
+```