Skip to content

Instantly share code, notes, and snippets.

@tobynet
Created October 4, 2008 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobynet/14739 to your computer and use it in GitHub Desktop.
Save tobynet/14739 to your computer and use it in GitHub Desktop.
UserActionScript of adding delicious bookmark for Slepnir2
/*
delicious.com 登録スクリプト
= 特徴
* 別のページで開く
* JavaScriptオフのページで当スクリプトを起動しても、
del.icio.us登録ページでは JavaScript がオンになり、
tagの補完などが効く。
= 履歴
* ver 0.2 2008/10/04 delicious.com に対応
* ver 0.1 2008/07/07 del.icio.us.com 対応
*/
(function(){
// 別のページで開く
var newtab = 1;
var pnir = new ActiveXObject("Sleipnir.API");
var id = pnir.GetDocumentID(pnir.ActiveIndex);
var document = pnir.GetDocumentObject(id);
if (document == null) {
pnir.MessageBox("タブがない");
return;
}
var url = document.location.href;
var title = document.title;
var nid;
if (newtab == 1)
nid = pnir.NewWindow('about:blank', true);
else
nid = id;
pnir.Navigate(nid, 'http://delicious.com/save?url='
+ encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&v=5&jump=no');
var flag = getSecurity();
flag.JavaScript = 1;
setSecurity(flag, nid);
// セキュリティ設定取得、sleipnir用
function getSecurity(){
return {
JavaScript : pnir.IsJavaScriptEnabled(id),
Java : pnir.IsJavaEnabled(id),
RunActiveX : pnir.IsRunActiveXEnabled(id),
DownloadActiveX : pnir.IsDownloadActiveXEnabled(id),
Picture : pnir.IsPictureEnabled(id),
Sound : pnir.IsSoundEnabled(id),
Video : pnir.IsVideoEnabled(id)
};
}
//セキュリティ設定変更 sleipnir用。
function setSecurity(s, id){
pnir.SetSecurity(
id, s.JavaScript, s.Java, s.RunActiveX, s.DownloadActiveX, s.Picture, s.Sound, s.Video
);
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment