Skip to content

Instantly share code, notes, and snippets.

@edvakf
edvakf / bookmarklet.js
Created August 24, 2011 17:50
Opera's bug, xpath "text()" returns non-text elements
javascript:(function(){
var x=document.evaluate('//body//text()',document,null,7,null);
for(var i=0,l=x.snapshotLength,e;e=x.snapshotItem(i++);i<l)
if(e.nodeType!==3)
console.log(e)
})()
// => [object HTMLDivElement]
//http://www.montrealgazette.com/Canadian+wireless+startup+takes+maverick+approach/5300364/story.html
// ==UserScript==
// @name fldr_show_fc2_images.user.js
// @namespace http://d.hatena.ne.jp/os0x/
// @description Make fc2 images viewable on LDR/Fastladder
// @include http://reader.livedoor.com/reader/
// @include http://reader.livedoor.com/public/*
// @include http://fastladder.com/reader/
// ==/UserScript==
// via http://gist.github.com/48621
@edvakf
edvakf / shorten_url.js
Created June 1, 2011 03:35
twicli の shorten_url.js 改変
/* assist inline URL shortening in the text area */
(function(){
var wait = 5000; // time to wait before deciding that the server is unreacheable
var _updateCount = window.updateCount;
var fst = $('fst');
var timer, ele, command, original;
var remove = function(e){if(e && e.parentNode)e.parentNode.removeChild(e); e = null};
var api = 'http://atsushaa.appspot.com/shorten/get';
var cache = {};
@edvakf
edvakf / nico-tumblr.js
Created May 26, 2011 07:48
ニコニコ動画から Tumblr に投稿するブックマークレット改変
/*
http://d.hatena.ne.jp/takeken/20091113/1258104204
これの改変バージョン。
ニコニコ動画の外部プレーヤー用のスクリプトは document.write を使ってるのでどうしても同期じゃないといけない。
そこで、iframe を作ってその中でニコニコ動画のスクリプトを読み込んでいる。
*/
javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.tumblr.com/share',l=d.location,e=encodeURIComponent;if(/nicovideo.jp/.test(l.host)){var n=location.href.match(/.*([ns]m[0-9]\d+)/)[1];k=Date.now();s='<a href="http://www.nicovideo.jp/watch/'+n+'">'+document.title+'<noscript><br><img width="300" src="http://tn-skr'+((Math.random()*4|0)+1)+'.smilevideo.jp/smile?i='+n.slice(2)+'"></noscript></a><script id="nicovideo_'+k+'">(function(d,s,v,f){f=d.createElement("iframe");f.style.border="none";f.height=385;f.width=485;v=d.getElementById(v);v.parentNode.insertBefore(f,v);f.contentDocument.write("<!DOCTYPE html><head><style>*{margin:0;padding:0;}body *{display:block}<\\/style><\\/head><body><scr"+"ipt src="+s+"><\\/scr"+"ipt><\\/body>")}(document,
var bigint;
// very very basic bigint class.
// complete version: https://github.com/dankogai/js-math-bigint
(function() {
// Original: http://www.onicos.com/staff/iz/amuse/javascript/expert/BigInt.txt
//
// BigInt.js - Arbitrary size integer math package for JavaScript
// Copyright (C) 2000 Masanao Izumo <iz@onicos.co.jp>
javascript:var div=document.createElement('div');div.style='position:fixed;left:0;top:0;height:100px;width:100px;background-color:red';document.body.appendChild(div);document.querySelector('#pnnext').click();

= 使い方

  1. Windows の「スタートアップ」フォルダに fotolife.wsf を入れます
  2. C:\Users\ユーザー名\Pictures\screenshot と C:\Users\ユーザー名\Pictures\screenshot\old というフォルダを作ります
  3. 画像を C:\Users\ユーザー名\Pictures\screenshot に保存します
  4. はてなフォトライフへのアップロードが始まります
  5. 保存した画像は C:\Users\ユーザー名\Pictures\screenshot\old に移されます
  6. はてなフォトライフのページがブラウザで開きます

最初に実行したときにユーザー名とパスワードを聞かれ、入力すると IE のクッキーを使ってログインします。クッキーを削除するとまたログインを求められます。

We couldn’t find that file to show.
// http://ido.nu/kuma/2007/10/01/diff-onp-javascript-implementation/
/*
Copyright (c) 2007, KUMAGAI Kentaro
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// Coffee Script compiler wrapper for WSH JScript (must be placed in the same directory as coffee-script.js)
// Usage: cscript coffee-maker.js [--watch] file
// inspired by http://kennyj-jp.blogspot.com/2011/01/coffeescriptwindows.html
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName.slice(
0, -WScript.ScriptName.length);
eval(fs.OpenTextFile(scriptPath + "coffee-script.js", 1).ReadAll());
function compileFile(file) {