Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const Thesaurus = '';
name: "thesaurus",
icon: Thesaurus +'favicon.ico',
takes: {word: noun_arb_text},
description: ''+<>Consults <a href={Thesaurus}></a>.</>,
execute: function({text}){
preview: function(pbl, {text}){
var q = jQuery.trim(text), $p = jQuery(pbl), $c = $p.find(ID);
if(!$c[0]) $c = $p.html(Base).find(ID), pq = '';
if(!q || pq === (pq = q)) return;
CmdUtils.previewAjax(pbl, {
url: makeReq(q),
success: function(htm){ setTables($c.removeClass(), htm) },
error: function(x, e){
error($c, x.status +' '+ x.statusText +' / '+ e) }});
author: 'satyr'.link(''), license: 'MIT'
function error($c, msg){ $c.addClass('error').text(msg) }
function makeReq(word)
''+ encodeURIComponent(word);
function setTables($c, htm){
var m = htm.match(/<table\b[^>]*?\bclass="the_content"[\s\S]+?\/table>/g);
m ? $c.html(m.join('')) : error($c, 'No matches.');
ID = '#_'+(Math.random()+'').slice(2),
Base = <div class="thesaurus"><style><![CDATA[
@table {border-collapse:separate; border-spacing:0px}
@td {font-size:88%; padding-right:4px}
@.error {font-style:oblique}
@table, @.error {padding-bottom:4px}
@.logo {display:block}
@.loading + .logo {opacity:0.5}
]]></style><div id={ID.slice(1)}/><a class="logo" href={Thesaurus}
><img height="43" border="0" style="background-color:#f4a50a"
></div>.toXMLString().replace(/@/g, '.thesaurus ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.