This $.get somehow escaped me.

This commit is contained in:
Zixaphir 2013-04-13 23:41:06 -07:00
parent 478a75d03e
commit 40165ef7e8
2 changed files with 26 additions and 21 deletions

View File

@ -6727,7 +6727,7 @@
} }
}, },
embedder: function(a) { embedder: function(a) {
var callbacks, embed, err, key, match, service, title, titles, type, _ref; var callbacks, embed, key, match, service, type, _ref;
if (!Conf['Embedding']) { if (!Conf['Embedding']) {
return [a]; return [a];
@ -6769,18 +6769,22 @@
embed.setAttribute('data-originalURL', a.href); embed.setAttribute('data-originalURL', a.href);
$.on(embed, 'click', Linkify.toggle); $.on(embed, 'click', Linkify.toggle);
if (Conf['Link Title'] && (service = type.title)) { if (Conf['Link Title'] && (service = type.title)) {
titles = $.get('CachedTitles', {}); $.get('CachedTitles', {}, function(item) {
if (title = titles[match[1]]) { var err, title, titles;
a.textContent = title[0];
embed.setAttribute('data-title', title[0]); titles = item['CachedTitles'];
} else { if (title = titles[match[1]]) {
try { a.textContent = title[0];
$.cache(service.api.call(a), callbacks); return embed.setAttribute('data-title', title[0]);
} catch (_error) { } else {
err = _error; try {
a.innerHTML = "[" + key + "] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"; return $.cache(service.api.call(a), callbacks);
} catch (_error) {
err = _error;
return a.innerHTML = "[" + key + "] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>";
}
} }
} });
} }
return [a, $.tn(' '), embed]; return [a, $.tn(' '), embed];
} }

View File

@ -4564,16 +4564,17 @@ Linkify =
$.on embed, 'click', Linkify.toggle $.on embed, 'click', Linkify.toggle
if Conf['Link Title'] and (service = type.title) if Conf['Link Title'] and (service = type.title)
titles = $.get 'CachedTitles', {} $.get 'CachedTitles', {}, (item) ->
titles = item['CachedTitles']
if title = titles[match[1]] if title = titles[match[1]]
a.textContent = title[0] a.textContent = title[0]
embed.setAttribute 'data-title', title[0] embed.setAttribute 'data-title', title[0]
else else
try try
$.cache service.api.call(a), callbacks $.cache service.api.call(a), callbacks
catch err catch err
a.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>" a.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"
return [a, $.tn(' '), embed] return [a, $.tn(' '), embed]
return [a] return [a]