-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfacebook.user.js
32 lines (25 loc) · 1.08 KB
/
facebook.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==UserScript==
// @name Support of facebook
// @namespace http://userscripts.org/users/290001
// @description facebook上でニコニコ動画を見るグリモン
// @include *facebook*
// @exclude
// @version 0.0.1.beta
// ==/UserScript==
(function () {
//まずはyoutubeの映像の埋め込みでテスト!
function youtube() {
var uatNum = document.getElementsByClassName('uiAttachmentTitle').length;
for (var i=0; i < uatNum; i++){
var uatNode = document.getElementsByClassName('uiAttachmentTitle')[i];
// var href = uatNode.firstChild.innerHTML.match(/https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:@&=+$,%#]+/g);
var href = uatNode.firstChild.innerHTML.match(/(http:\/\/[a-zA-Z\.]+\.youtube\.com\/).*v=([^&]+)/g);
var ytID = uatNode.firstChild.innerHTML.match(/v=([^&\s]+)/g);
var scrNode = '<iframe width="265" height="228" src="http://www.youtube.com/embed/' + ytID + '" frameborder="0" allowfullscreen></iframe>';
if(href){
uatNode.innerHTML = uatNode.innerHTML + scrNode.replace(/v=/,"");
}
}
}
youtube();
}());