东方时尚约车脚本(greaseMoney)

因为东方时尚改版, 请参看约车脚本2.0

约车辛苦啊, 不停的刷新。。。
刚看到有车, 一点又没了,,,

愤怒之下, 写了个自动刷新脚本, 自动帮你约车.
可以定义多个需要预订的时段~~

脚本可以无人值守…

享受吧~~ 呵呵

安装地址: dffs booking script

代码如下:

 // ==UserScript== // @name           dffs_booking_script // @namespace      dffs.booking // @include        http://yueche.dfss.cn/web/cmp/yc.aspx?StudentID=0942978 // @version     1.0.3 // @author     laruence<laruence at yahoo.com.cn> // @copyright    Copyright (c) 2009  laruence , All rights Reserved // ==/UserScript== //  /**  * monday = 1, sunday = 0  * 7:00-9:00 = 1, 19:00-21:00 = 5 ,  * [ [5, 5], [6, 1] ] 的意思是, 我要预约星期5晚上19点到21点,  * 和星期六7点到9点,  * 修改这个为你想要的时段吧  */ var expect_period = [ [6, 1], [6, 2], [0, 1], [0, 2], [0, 3], [0, 4],[0, 5] ];  //每次请求之间的延迟, 不用太短, 机器会郁闷的。 var delay = 10; //5秒 //  var START = true; var delegate = function(expect_period) {  var day_map  = ['日', '一', '二', '三', '四', '五', '六'];  var period_map = ['7-9', '9-13', '13-17', '17-19', '19-21'];  var url   = window.location.href;  var book_day  = [];  var book_period = [];  var self  = this;  var time  = new Date();  var today  = time.getDay();   for ( var key in expect_period ) {   book_day[key]     = day_map[expect_period[key][0]];   book_period[key]  = period_map[expect_period[key][1] -1];  }    if( typeof delegate.__initilized__ == 'undefined' ) {   delegate.prototype.init  = function(flag) {    var x = document.createElement("div");    var btn = null;    x.id = "m-btn-o";    x.innerHTML = "<style>#m-btn-o{border:solid 2px red;background-color:#ccc;left:740px;top:110px;position:absolute;}</style>";    document.body.appendChild(x);    if ( flag ) {     x.innerHTML += "<button id='m-btn'>开始约车</button>";     btn = document.getElementById("m-btn");     btn.addEventListener("click", function() {       window.location.replace(url + '&automatic_booking=1');     }, false);    } else {     x.innerHTML += "<button id='m-btn'>停止</button>";     btn = document.getElementById("m-btn");     btn.addEventListener('click', function() {        window.location.replace(url.replace('&automatic_booking=1', ''));       }, false);     setTimeout( function() {      self.start();     },  2000);    }   }    delegate.prototype.start = function() {    /*    GM_xmlhttpRequest( {     method : "GET",     url : url,     onload : function(o) {      var text = o.responseText;      self.isAvailable(text);     },     onerror : function(e) {      GM_log("Error occurred");     }    });    */    var text = document.getElementById('gridgrid_div').innerHTML;    self.isAvailable(text);   }   delegate.prototype.isAvailable = function(text){    for ( var i=0, l=expect_period.length; i<l; i++ ) {      var expect_day = expect_period[i][0];      expect_day  = ((expect_day - today) + 7) % 7;      var id = "grid_grid_ci_0_" + expect_period[i][1] + "_" + expect_day + "_imgButton";      var input = null;      if( (input = document.getElementById(id) )        && input.src.indexOf('02.gif') != -1 ) {       /**        * igtbl functions        * defined in ig_WebGrid.js line 2477        */       var grid = unsafeWindow.igtbl_getGridById('gridgrid');       var cellId = "gridgridrc_" + expect_day + "_" + expect_period[i][1];       var cell   = unsafeWindow.igtbl_getCellById(cellId);        grid.setActiveCell(cell); // important       var evt = document.createEvent("MouseEvents");       evt.initEvent("click", true, true);       input.dispatchEvent(evt);       return true;      }     }     url += (url.indexOf("automatic_booking") != -1) ?  '' : '&automatic_booking=1';     window.location.replace(url);   }   delegate.__initilized__ = true;  } }  window.addEventListener('load',  function() {  var agent = new delegate(expect_period);  if ( window.location.href.indexOf('automatic_booking=1') != -1 ) {   agent.init(!START);  } else {   agent.init(START);  } }, false); 

使用方法, 使用firefox, 并且安装greaseMonkey插件。 对这个不明白, 可以问问google, 他知道.

发表评论

电子邮件地址不会被公开。 必填项已用*标注