Fix link title depending on embedding
This commit is contained in:
parent
23f1b9a1bf
commit
286047cc44
@ -1,5 +1,6 @@
|
|||||||
seaweedchan:
|
seaweedchan:
|
||||||
- Fix various embedding issues
|
- Fix various embedding issues
|
||||||
|
- Fix Link Title depending on Embedding
|
||||||
|
|
||||||
### 1.1.4 - 2013-04-29
|
### 1.1.4 - 2013-04-29
|
||||||
seaweedchan:
|
seaweedchan:
|
||||||
|
|||||||
@ -4211,6 +4211,7 @@
|
|||||||
textContent: this.getAttribute("data-title") || url
|
textContent: this.getAttribute("data-title") || url
|
||||||
});
|
});
|
||||||
this.textContent = '(embed)';
|
this.textContent = '(embed)';
|
||||||
|
$.addClass(el, "" + (this.getAttribute('data-service')));
|
||||||
} else {
|
} else {
|
||||||
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
||||||
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
||||||
@ -4320,7 +4321,7 @@
|
|||||||
embedder: function(a) {
|
embedder: function(a) {
|
||||||
var callbacks, embed, key, match, service, titles, type, _ref;
|
var callbacks, embed, key, match, service, titles, type, _ref;
|
||||||
|
|
||||||
if (!Conf['Embedding']) {
|
if (!Conf['Link Title']) {
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
titles = {};
|
titles = {};
|
||||||
@ -4331,7 +4332,7 @@
|
|||||||
switch (this.status) {
|
switch (this.status) {
|
||||||
case 200:
|
case 200:
|
||||||
case 304:
|
case 304:
|
||||||
title = "[" + (embed.getAttribute('data-service')) + "] " + (service.text.call(this));
|
title = "" + (service.text.call(this));
|
||||||
embed.setAttribute('data-title', title);
|
embed.setAttribute('data-title', title);
|
||||||
titles[embed.name] = [title, Date.now()];
|
titles[embed.name] = [title, Date.now()];
|
||||||
$.set('CachedTitles', titles);
|
$.set('CachedTitles', titles);
|
||||||
@ -4359,7 +4360,11 @@
|
|||||||
});
|
});
|
||||||
embed.setAttribute('data-service', key);
|
embed.setAttribute('data-service', key);
|
||||||
embed.setAttribute('data-originalURL', a.href);
|
embed.setAttribute('data-originalURL', a.href);
|
||||||
|
$.addClass(a, "" + (embed.getAttribute('data-service')));
|
||||||
$.on(embed, 'click', Linkify.toggle);
|
$.on(embed, 'click', Linkify.toggle);
|
||||||
|
if (!Conf['Embedding']) {
|
||||||
|
embed.hidden = true;
|
||||||
|
}
|
||||||
if (Conf['Link Title'] && (service = type.title)) {
|
if (Conf['Link Title'] && (service = type.title)) {
|
||||||
$.get('CachedTitles', {}, function(item) {
|
$.get('CachedTitles', {}, function(item) {
|
||||||
var err, title;
|
var err, title;
|
||||||
@ -4377,8 +4382,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return [a, $.tn(' '), embed];
|
||||||
}
|
}
|
||||||
return [a, $.tn(' '), embed];
|
|
||||||
}
|
}
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4207,6 +4207,7 @@
|
|||||||
textContent: this.getAttribute("data-title") || url
|
textContent: this.getAttribute("data-title") || url
|
||||||
});
|
});
|
||||||
this.textContent = '(embed)';
|
this.textContent = '(embed)';
|
||||||
|
$.addClass(el, "" + (this.getAttribute('data-service')));
|
||||||
} else {
|
} else {
|
||||||
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
||||||
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
||||||
@ -4316,7 +4317,7 @@
|
|||||||
embedder: function(a) {
|
embedder: function(a) {
|
||||||
var callbacks, embed, key, match, service, titles, type, _ref;
|
var callbacks, embed, key, match, service, titles, type, _ref;
|
||||||
|
|
||||||
if (!Conf['Embedding']) {
|
if (!Conf['Link Title']) {
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
titles = {};
|
titles = {};
|
||||||
@ -4327,7 +4328,7 @@
|
|||||||
switch (this.status) {
|
switch (this.status) {
|
||||||
case 200:
|
case 200:
|
||||||
case 304:
|
case 304:
|
||||||
title = "[" + (embed.getAttribute('data-service')) + "] " + (service.text.call(this));
|
title = "" + (service.text.call(this));
|
||||||
embed.setAttribute('data-title', title);
|
embed.setAttribute('data-title', title);
|
||||||
titles[embed.name] = [title, Date.now()];
|
titles[embed.name] = [title, Date.now()];
|
||||||
$.set('CachedTitles', titles);
|
$.set('CachedTitles', titles);
|
||||||
@ -4355,7 +4356,11 @@
|
|||||||
});
|
});
|
||||||
embed.setAttribute('data-service', key);
|
embed.setAttribute('data-service', key);
|
||||||
embed.setAttribute('data-originalURL', a.href);
|
embed.setAttribute('data-originalURL', a.href);
|
||||||
|
$.addClass(a, "" + (embed.getAttribute('data-service')));
|
||||||
$.on(embed, 'click', Linkify.toggle);
|
$.on(embed, 'click', Linkify.toggle);
|
||||||
|
if (!Conf['Embedding']) {
|
||||||
|
embed.hidden = true;
|
||||||
|
}
|
||||||
if (Conf['Link Title'] && (service = type.title)) {
|
if (Conf['Link Title'] && (service = type.title)) {
|
||||||
$.get('CachedTitles', {}, function(item) {
|
$.get('CachedTitles', {}, function(item) {
|
||||||
var err, title;
|
var err, title;
|
||||||
@ -4373,8 +4378,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return [a, $.tn(' '), embed];
|
||||||
}
|
}
|
||||||
return [a, $.tn(' '), embed];
|
|
||||||
}
|
}
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4210,6 +4210,7 @@
|
|||||||
textContent: this.getAttribute("data-title") || url
|
textContent: this.getAttribute("data-title") || url
|
||||||
});
|
});
|
||||||
this.textContent = '(embed)';
|
this.textContent = '(embed)';
|
||||||
|
$.addClass(el, "" + (this.getAttribute('data-service')));
|
||||||
} else {
|
} else {
|
||||||
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
|
||||||
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
|
||||||
@ -4319,7 +4320,7 @@
|
|||||||
embedder: function(a) {
|
embedder: function(a) {
|
||||||
var callbacks, embed, key, match, service, titles, type, _ref;
|
var callbacks, embed, key, match, service, titles, type, _ref;
|
||||||
|
|
||||||
if (!Conf['Embedding']) {
|
if (!Conf['Link Title']) {
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
titles = {};
|
titles = {};
|
||||||
@ -4330,7 +4331,7 @@
|
|||||||
switch (this.status) {
|
switch (this.status) {
|
||||||
case 200:
|
case 200:
|
||||||
case 304:
|
case 304:
|
||||||
title = "[" + (embed.getAttribute('data-service')) + "] " + (service.text.call(this));
|
title = "" + (service.text.call(this));
|
||||||
embed.setAttribute('data-title', title);
|
embed.setAttribute('data-title', title);
|
||||||
titles[embed.name] = [title, Date.now()];
|
titles[embed.name] = [title, Date.now()];
|
||||||
$.set('CachedTitles', titles);
|
$.set('CachedTitles', titles);
|
||||||
@ -4358,7 +4359,11 @@
|
|||||||
});
|
});
|
||||||
embed.setAttribute('data-service', key);
|
embed.setAttribute('data-service', key);
|
||||||
embed.setAttribute('data-originalURL', a.href);
|
embed.setAttribute('data-originalURL', a.href);
|
||||||
|
$.addClass(a, "" + (embed.getAttribute('data-service')));
|
||||||
$.on(embed, 'click', Linkify.toggle);
|
$.on(embed, 'click', Linkify.toggle);
|
||||||
|
if (!Conf['Embedding']) {
|
||||||
|
embed.hidden = true;
|
||||||
|
}
|
||||||
if (Conf['Link Title'] && (service = type.title)) {
|
if (Conf['Link Title'] && (service = type.title)) {
|
||||||
$.get('CachedTitles', {}, function(item) {
|
$.get('CachedTitles', {}, function(item) {
|
||||||
var err, title;
|
var err, title;
|
||||||
@ -4376,8 +4381,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return [a, $.tn(' '), embed];
|
||||||
}
|
}
|
||||||
return [a, $.tn(' '), embed];
|
|
||||||
}
|
}
|
||||||
return [a];
|
return [a];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,6 +125,7 @@ Linkify =
|
|||||||
textContent: @getAttribute("data-title") or url
|
textContent: @getAttribute("data-title") or url
|
||||||
|
|
||||||
@textContent = '(embed)'
|
@textContent = '(embed)'
|
||||||
|
$.addClass el, "#{@getAttribute 'data-service'}"
|
||||||
|
|
||||||
else
|
else
|
||||||
# We create an element to embed
|
# We create an element to embed
|
||||||
@ -203,16 +204,16 @@ Linkify =
|
|||||||
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/
|
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/
|
||||||
el: ->
|
el: ->
|
||||||
div = $.el 'iframe',
|
div = $.el 'iframe',
|
||||||
src: "http://pastebin.com/embed_iframe.php?i=#{@name}"
|
src: "http://pastebin.com/embed_iframe.php?i=#{@name}"
|
||||||
|
|
||||||
embedder: (a) ->
|
embedder: (a) ->
|
||||||
return [a] unless Conf['Embedding']
|
return [a] unless Conf['Link Title']
|
||||||
titles = {}
|
titles = {}
|
||||||
|
|
||||||
callbacks = ->
|
callbacks = ->
|
||||||
a.textContent = switch @status
|
a.textContent = switch @status
|
||||||
when 200, 304
|
when 200, 304
|
||||||
title = "[#{embed.getAttribute 'data-service'}] #{service.text.call @}"
|
title = "#{service.text.call @}"
|
||||||
embed.setAttribute 'data-title', title
|
embed.setAttribute 'data-title', title
|
||||||
titles[embed.name] = [title, Date.now()]
|
titles[embed.name] = [title, Date.now()]
|
||||||
$.set 'CachedTitles', titles
|
$.set 'CachedTitles', titles
|
||||||
@ -235,13 +236,16 @@ Linkify =
|
|||||||
|
|
||||||
embed.setAttribute 'data-service', key
|
embed.setAttribute 'data-service', key
|
||||||
embed.setAttribute 'data-originalURL', a.href
|
embed.setAttribute 'data-originalURL', a.href
|
||||||
|
$.addClass a, "#{embed.getAttribute 'data-service'}"
|
||||||
|
|
||||||
$.on embed, 'click', Linkify.toggle
|
$.on embed, 'click', Linkify.toggle
|
||||||
|
|
||||||
|
unless Conf['Embedding']
|
||||||
|
embed.hidden = true
|
||||||
|
|
||||||
if Conf['Link Title'] and (service = type.title)
|
if Conf['Link Title'] and (service = type.title)
|
||||||
$.get 'CachedTitles', {}, (item) ->
|
$.get 'CachedTitles', {}, (item) ->
|
||||||
titles = item['CachedTitles']
|
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]
|
||||||
@ -251,5 +255,5 @@ Linkify =
|
|||||||
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]
|
||||||
Loading…
x
Reference in New Issue
Block a user