MyMixi Them All

    @@ -1,15 +1,67 @@ /* - * @title test - * @description test - * @include http://* + * @title MyMixi Them All + * @description まだ作ってる中 + * @include http://mixi.jp/ * @license MIT License * @require JSDeferred + * @require jquery + * @require jquery-ui.googlecode.com/svn/trunk/tests/jquery.simulate.js */ -with(D()) { +Deferred = D(); + +Deferred.iframe = function iframe(url) { + var iframeEl = document.createElement('iframe'); + iframeEl.src = url; + document.body.insertBefore(iframeEl, document.body.firstChild); + + var d = new Deferred(); + iframeEl.onload = function() { + var win = iframeEl.contentWindow; + d.call(win); + } + return d; +}; + +Deferred.xpath = function xpath(expr, ctx, callback) { + var doc = ctx.nodeType === 9 ? ctx : ctx.ownerDocument; + var r = doc.evaluate(expr, ctx, null, 7, null); + return Deferred.loop(r.snapshotLength, function (i) { + return callback(r.snapshotItem(i), r, i, expr); + }); +}; + +Deferred.clickAndWait = function xpath(el) { + var iframeEl = el.ownerDocument.defaultView.frameElement; + var d = new Deferred(); + iframeEl.onload = function() { + var win = iframeEl.contentWindow; + d.call(win); + } + jQuery(el).simulate('click'); + return d; +}; + +with(Deferred) { + xpath('//a[contains(@href, "show_friend.pl")]', win.document, function(el) { + return iframe(el.href). + next(function(win) { + return xpath('//a[contains(@href, "add_friend.pl")]', win.document, function(el) { + return clickAndWait(el). + next(function(win) { + jQuery(win.document.getElementById('message')).value('よろしくおねがいします!'); + return clickAndWait(win.$$('.formBt01')[0]). + next(function(win) { + return clickAndWait(win.$$('.formBt01')[0]). + wait(4); + }); + }); + }); + }); + }). next(function() { - throw Error('test'); - }) + alert('finish!'); + }); .error(function(e) { alert('Error: ' + e.message + '\nStack: ' + e.stack) }); } void(0);
  • /*
     * @title MyMixi Them All
     * @description まだ作ってる中
     * @include http://mixi.jp/
     * @license MIT License
     * @require JSDeferred
     * @require jquery
     * @require jquery-ui.googlecode.com/svn/trunk/tests/jquery.simulate.js
     */
    
    Deferred = D();
    
    Deferred.iframe = function iframe(url) {
        var iframeEl = document.createElement('iframe');
        iframeEl.src = url;
        document.body.insertBefore(iframeEl, document.body.firstChild);
    
        var d = new Deferred();
        iframeEl.onload = function() {
            var win = iframeEl.contentWindow;
            d.call(win);
        }
        return d;
    };
    
    Deferred.xpath = function xpath(expr, ctx, callback) {
        var doc = ctx.nodeType === 9 ? ctx : ctx.ownerDocument;
        var r = doc.evaluate(expr, ctx, null, 7, null);
        return Deferred.loop(r.snapshotLength, function (i) {
    	return callback(r.snapshotItem(i), r, i, expr);
        });
    };
    
    Deferred.clickAndWait = function xpath(el) {
        var iframeEl = el.ownerDocument.defaultView.frameElement;
        var d = new Deferred();
        iframeEl.onload = function() {
            var win = iframeEl.contentWindow;
            d.call(win);
        }
        jQuery(el).simulate('click');
        return d;
    };
    
    with(Deferred) {
        xpath('//a[contains(@href, "show_friend.pl")]', win.document, function(el) {
            return iframe(el.href).
            next(function(win) {
                return xpath('//a[contains(@href, "add_friend.pl")]', win.document, function(el) {
                    return clickAndWait(el).
                    next(function(win) {
                        jQuery(win.document.getElementById('message')).value('よろしくおねがいします!');
                        return clickAndWait(win.$$('.formBt01')[0]).
                        next(function(win) {
                            return clickAndWait(win.$$('.formBt01')[0]).
                            wait(4);
                        });
                    });
                });
            });
        }).
        next(function() {
            alert('finish!');
        });
        .error(function(e) { alert('Error: ' + e.message + '\nStack: ' + e.stack) });
    }
    void(0);
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2010/05/18 00:29:06 - 2010-05-18
  2. 2010/05/18 00:27:59 - 2010-05-18
  3. 2010/05/18 00:26:41 - 2010-05-18
  4. 2010/05/18 00:24:47 - 2010-05-18
  5. 2010/05/18 00:18:25 - 2010-05-18
  6. 2010/05/18 00:15:30 - 2010-05-18
  7. 2010/05/18 00:11:02 - 2010-05-18
  8. 2010/05/18 00:09:22 - 2010-05-18
  9. 2010/05/18 00:08:46 - 2010-05-18
  10. 2010/05/18 00:01:42 - 2010-05-18
  11. 2010/05/18 00:01:01 - 2010-05-18
  12. 2010/05/17 23:58:49 - 2010-05-17
  13. 2010/05/17 23:58:04 - 2010-05-17
  14. 2010/05/17 23:54:14 - 2010-05-17
  15. 2010/05/17 23:53:48 - 2010-05-17
  16. 2010/05/17 23:53:11 - 2010-05-17
  17. 2010/05/17 23:52:17 - 2010-05-17
  18. 2010/05/17 23:44:50 - 2010-05-17
  19. 2010/05/17 23:40:05 - 2010-05-17
  20. 2010/05/17 23:34:22 - 2010-05-17
  21. 2010/05/17 23:31:56 - 2010-05-17
  22. 2010/05/17 23:28:54 - 2010-05-17
  23. 2010/05/17 23:26:27 - 2010-05-17
  24. 2010/05/17 23:22:41 - 2010-05-17
  25. 2010/05/17 23:19:04 - 2010-05-17
  26. 2010/05/17 23:18:00 - 2010-05-17
  27. 2010/05/17 23:17:01 - 2010-05-17
  28. 2010/05/17 23:15:44 - 2010-05-17
  29. 2010/05/17 23:15:04 - 2010-05-17
  30. 2010/05/17 23:12:51 - 2010-05-17
  31. 2010/05/17 23:08:43 - 2010-05-17
  32. 2010/05/17 22:19:34 - 2010-05-17
  33. 2010/05/17 22:18:20 - 2010-05-17
  34. 2010/05/17 22:17:21 - 2010-05-17
  35. 2010/05/17 22:16:26 - 2010-05-17
  36. 2010/05/17 22:13:29 - 2010-05-17