Tumblr 书签 javascript 中的 tstbklt() 有何作用?
javascript: var d = document,
w = window,
e = w.getSelection,
k = d.getSelection,
x = d.selection,
s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)),
f = 'http://www.tumblr.com/share',
l = d.location,
e = encodeURIComponent,
p = '?v=3&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s),
u = f + p;
try {
if (!/^(.*\.)?tumblr[^.]*$/.test(l.host)) throw (0);
tstbklt();
} catch (z) {
a = function () {
if (!w.open(u, 't', 'toolbar=0,resizable=0,status=1,width=450,height=430')) l.href = u;
};
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
else a();
}
void(0)
以下是来自 Tumblr 书签的代码。 我明白这一切,但我无法找出 tstbklt(); 函数的用途...
我只是很好奇,有人知道吗?
javascript: var d = document,
w = window,
e = w.getSelection,
k = d.getSelection,
x = d.selection,
s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)),
f = 'http://www.tumblr.com/share',
l = d.location,
e = encodeURIComponent,
p = '?v=3&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s),
u = f + p;
try {
if (!/^(.*\.)?tumblr[^.]*$/.test(l.host)) throw (0);
tstbklt();
} catch (z) {
a = function () {
if (!w.open(u, 't', 'toolbar=0,resizable=0,status=1,width=450,height=430')) l.href = u;
};
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
else a();
}
void(0)
Here's the code from the Tumblr's bookmarklet.
I understand it all but I can't find out what the tstbklt();
function is for...
I'm just curious, anyone got an idea on that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
函数
tstbklt
似乎仅在 http://tumblr.com/goodies 上定义(需要帐户),如下所示:在定义 tstbklt 函数以外的任何页面上,都会抛出错误,并且将执行
catch
子句。The function
tstbklt
appears to only be defined on http://tumblr.com/goodies (account required), as follows:On any page other than where a tstbklt function is defined, an error will be thrown and the
catch
clause will execute.