我試圖創建一個userscript,它自動將當前網址的QR碼圖像添加到YouTube視頻頁面上的「共享」菜單。Youtube QR代碼生成UserScript不起作用
我知道旁邊沒有JavaScript的,UserScript,HTML等 ,但是,這是我到目前爲止有:
// ==UserScript==
// @name Youtube QR ShareLink
// @description Displays QR of youtube URL
// @version 0.1
// @match http://www.youtube.com/watch*
// @match https://www.youtube.com/?*
// @match http://www.youtube.com/?*
// @match https://www.youtube.com/watch*
// @include http://www.youtube.com/?*
// @include http://www.youtube.com/watch*
// @include https://www.youtube.com/?*
// @include https://www.youtube.com/watch*
// ==/UserScript==
(function() {
var shareDiv = document.getElementById('share-option-container ytg-box');
var qrIMG = 'http://chart.googleapis.com/chart?chl=' + window.location.href + '&chld=M%7C0&cht=qr&chs=125x125';
var img = document.createElement('qrcode');
img.src=qrIMG;
img.width=125;
img.height=125;
shareDiv.appendChild(img);
}());
不出所料,這是行不通的。 任何人都可以請告訴我我做錯了什麼?
謝謝!
這裏沒有任何意義:''share-option-container ytg-box''一個'id'不能有空格。 – 2012-02-25 20:41:04