Post hostname with bookmark

This commit is contained in:
Ruud
2012-03-18 17:44:20 +01:00
parent 4cca9fbb6a
commit 7dd89247f2
3 changed files with 7 additions and 4 deletions
@@ -34,7 +34,7 @@ var addUserscript = function() {
var e = document.createElement('script');
e.setAttribute('type', 'text/javascript');
e.setAttribute('charset', 'UTF-8');
e.setAttribute('src', '{{host}}/userscript.get/couchpotato.js?r=' + Math.random() * 99999999);
e.setAttribute('src', '{{host}}couchpotato.js?r=' + Math.random() * 99999999);
document.body.appendChild(e)
}
if(isCorrectUrl())
+1 -1
View File
@@ -31,7 +31,7 @@ class Userscript(Plugin):
params = {
'includes': fireEvent('userscript.get_includes', merge = True),
'excludes': fireEvent('userscript.get_excludes', merge = True),
'host': fireEvent('app.api_url', single = True)
'host': getParam('host', None),
}
return self.renderTemplate(__file__, 'bookmark.js', **params)
@@ -72,6 +72,8 @@ var UserscriptSettingTab = new Class({
catch(e){
userscript = Browser.chrome === true;
}
var host_url = window.location.protocol + '//' + window.location.host;
self.settings.createGroup({
'name': 'userscript',
@@ -87,8 +89,9 @@ var UserscriptSettingTab = new Class({
new Element('a.button.green', {
'text': '+CouchPotato',
'href': "javascript:void((function(){var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','" +
window.location.protocol + '//' + window.location.host + Api.createUrl('userscript.bookmark') +
"?r='+Math.random()*99999999);document.body.appendChild(e)})());",
host_url + Api.createUrl('userscript.bookmark') +
"?host="+ encodeURI(host_url + Api.createUrl('userscript.get')) +
"&r='+Math.random()*99999999);document.body.appendChild(e)})());",
'target': '',
'events': {
'click': function(e){