顯示具有 javascript 標籤的文章。 顯示所有文章
顯示具有 javascript 標籤的文章。 顯示所有文章

星期四, 7月 07, 2011

【JS】伊莉 玄幻魔法小說 閱讀 腳本

伊莉 玄幻魔法小說 閱讀 腳本
去年有寫一個看小說的腳本 ,只是最近打開發現 似乎不會動了。
把裡面的一些小問題修正後,再加入了 章節選擇的功能,
選擇功能只限定 第XXXX章,改天再來改別種的條件。
1.需求: Firefox + scriptish 
2.腳本: http://cxdata.googlecode.com/files/yilistory2-91.user.js
P.S. 只針對 伊利 玄幻魔法小說 版。
功能:
        1. 只留 文章內容。
        2. 字體 放大縮小。
        3. 按ESC 可以自動向下 捲軸。
        4. 章節 選擇功能(new!!)







 影片範例:

星期六, 4月 03, 2010

【fancybox】AJAX來進行POST傳送

html 裡面的href 在網址的最後面
 放入#1 意思就是 $_POST['selector'] = 1

【html】
<a href="http://.../SummaryView/#1" class="adinfo2">
title="摘要"&gt;顯示摘要</a>
</code>

【JS】
<script type="text/javascript">
...
$(".adinfo2").fancybox({
ajax : {
  type: "POST"
}
});
....
</script>


【PHP】
//使用 selector 接收
echo $_POST['selector'];
?>




星期一, 3月 29, 2010

字型大小blogger

http://mingray.blogspot.com/2009/08/blogger.html
看到可以加入 調整字型的工具!!
效果很棒!!!

星期日, 10月 18, 2009

nkut 網路學習 增加在線時間

在南開 ,學校的網路學習系統 都會有計時器的功能,
當你瀏覽一篇文章 他就會幫你計時,
有些老師就會看你有沒有認真在上課,像是一個小時加0.001分,
這個時候你就可以得到分數,所以小弟就寫了一個腳本,
去呼叫他本身的計時器函數,由於他的計時器有缺陷,
所以可以以1秒六小時來衝時間,此時我的時間就變成14年。
分數也增加到很多。
// ==UserScript==
//XXXzi4 ji2 xiang3 xiang4 ba0 !!
//nkut_elearning v0.4
// ==/UserScript==
/*
http://elearning.nkut.edu.tw/learn/path/SCORM_fetchResource.php
*/
var nkute = "http://elearning.nkut.edu.tw/learn/index.php";
var valdata = "
時間";
valdata += "";;
valdata += "";
valdata += "";
valdata += "";
valdata += "";
valdata += "";
valdata += "";
valdata += "";
valdata += "
test
test
test
test
test
test
test
";
valdata += "
";

var mun =0;
var msg;

var switch_1 = 0;
var time_n = 0;
var time_m = 1;
var time_d = 1;
var last_check = new Date();
var time_s = 1;

var href;
var prev_href;
var prev_node_id;
var prev_node_title;
var begin_time;
var post_url;

var $;
// Add jQuery
var GM_JQ = document.createElement("script");
GM_JQ.src = "http://code.jquery.com/jquery-latest.min.js";
GM_JQ.type = "text/javascript";
document.body.appendChild(GM_JQ);
// Check if jQuery's loaded
var checker2;
var checker;

function JQuery_run(){
if(switch_1 == 0){
var fight_data = $(valdata);
//alert($("body").html());
//$(".hosp").html("");
fight_data.addClass("fight_data").attr('id','fight_data');
fight_data.prependTo("#displayPanel");

if(location.href == "http://elearning.nkut.edu.tw/learn/path/pathtree.php"){
href = $("#fetchResourceForm").children("input:eq(0)").attr("value"); //$("input").val(); children("li:eq(0)")
prev_href = $("#fetchResourceForm").children("input:eq(1)").attr("value");
prev_node_id = $("#fetchResourceForm").children("input:eq(2)").attr("value");
prev_node_title = $("#fetchResourceForm").children("input:eq(3)").attr("value");
begin_time = $("#fetchResourceForm").children("input:eq(4)").attr("value");
//alert(href + "\n" + prev_href + "\n" + prev_node_id + "\n" + prev_node_title + "\n" + begin_time + "\n");
begin_time = "2000-10-13 13:08:18";
post_url = "href="+ href +"&prev_href="+ prev_href +"&prev_node_id="+ prev_node_id +"&prev_node_title="+ prev_node_title +"&begin_time="+ begin_time;
//alert(post_url);
//cx_run();
//alert($("body").html());
if(href != ""){
switch_1 = 1;
//alert(switch_1);
}else{
//錯誤時.
}
}
}
if(switch_1 != 0){
//alert(switch_1);
$("#toolbar").html("asdfasdf");
var current = new Date();
var seconds = (current - last_check) / 1000;
//time = parseInt(time_s-seconds);
// $("#t1").html(time);
// $("#t2").html(begin_time);
$("#t3").html("href = "+href);
$("#t4").html("prev_href = "+prev_href);
$("#t5").html("prev_node_id = "+prev_node_id);
$("#t6").html("prev_node_title = "+prev_node_title);//prev_node_title
$("#t6").html("post_url = "+post_url);//post_url
$("#t7").html(mun);
if(time <= 0){ //alert(time); last_check = current; if(time_m == 13){ time_n += 1; time_m = 1; } if(time_n == 50){ time_n = 0; } if(time_d == 30){ time_d = 0; time_m += 1; } year1 = 1996 + time_n; var ydm = new Date(); ydm.setFullYear(year1,time_m,time_d); ydm.setHours(13,35,1);//ydm.setHours(20,35,1); begin_time = curDateTime(ydm); post_url = "href="+ href +"&prev_href="+ prev_href +"&prev_node_id="+ prev_node_id +"&prev_node_title="+ prev_node_title +"&begin_time="+ begin_time; time_d +=1; //cx_run(); test_run(); } } } function test_run(){ GM_xmlhttpRequest({ method: 'POST', url: "http://elearning.nkut.edu.tw/learn/path/SCORM_fetchResource.php", data: encodeURI(post_url), headers: { "Content-type" : "application/x-www-form-urlencoded" }, onload: function(response) {//response mun +=1; } }); } function fetchServerTime(){ return begin_time; } function curDateTime(d){ var year = d.getFullYear(); var month = d.getMonth(); var date = d.getDate(); var day = d.getDay(); var hours = d.getHours(); var minutes = d.getMinutes(); var seconds = d.getSeconds(); var ms = d.getMilliseconds(); var curDateTime= year; if(month>9)
curDateTime = curDateTime +"-"+month;
else
curDateTime = curDateTime +"-0"+month;
if(date>9)
curDateTime = curDateTime +"-"+date;
else
curDateTime = curDateTime +"-0"+date;
if(hours>9)
curDateTime = curDateTime +" "+hours;
else
curDateTime = curDateTime +" 0"+hours;
if(minutes>9)
curDateTime = curDateTime +":"+minutes;
else
curDateTime = curDateTime +":0"+minutes;
if(seconds>9)
curDateTime = curDateTime +":"+seconds;
else
curDateTime = curDateTime +":0"+seconds;
return curDateTime;
}

//post 工具
function cx_run(){
GM_xmlhttpRequest(
{
method: 'POST',
url: encodeURI("http://elearning.nkut.edu.tw/learn/path/SCORM_fetchResource.php"),
headers: { "Content-type" : "application/x-www-form-urlencoded" },
data: encodeURI(post_url),
onload: function(req)
{
mun +=1;
return 0;
//msg = response.responseText;
}
});
return 0;
}

window.setTimeout(function() {
//checker2=setInterval(function(){
if(typeof ($ = unsafeWindow.jQuery) != "undefined") {
clearInterval(checker);
JQuery_run();
}},1000);
}, 1000);

星期日, 9月 20, 2009

義氣仔女 v0.1 腳本

修改自 neo@orz.hk, Moochi, 真正john
關閉自動任務 id = 0
代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:12
放貴利 id:7, req:14
打劫銀行 id:8, req:16
連環洗劫金鋪 id:9, req:20
綁架重要人物 id:10, req:25
走私毒品 id:11, req:30
經營外圍投注 id:12, req:35


this.renwu_selece_id = 5; //修改任務
this.renwu_selece_reg = 10; //修改體力


// ==UserScript==
// @name cx-sf-t1
// @description by CX, neo@orz.hk, Moochi, 真正john
// @namespace http://apps.facebook.com/street-fights/
// @include http://apps.facebook.com/street-fights/job.php
// @include http://apps.facebook.com/street-fights/bank.php
//2009-8/28 cx-sf-t1 Version 0.1 by cx
// ==/UserScript==
/*pf
Requirement:
- Firefox 3.0.1 or better
- Firefox plugin: Greasemonkey
- Facebook w/ the new interface

function sf_obj() 設定任務,和體力
renwu_selece: id & reg
義氣仔女Online
關閉自動任務 id = 0
代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:15
放貴利 id:7, req:18
打劫銀行 id:8, req:25
連環洗劫金鋪 id:9, req:30

代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:12
放貴利 id:7, req:14
打劫銀行 id:8, req:16
連環洗劫金鋪 id:9, req:20
綁架重要人物 id:10, req:25
走私毒品 id:11, req:30
經營外圍投注 id:12, req:35
*/

var job = "http://apps.facebook.com/street-fights/job.php";
var bank = "http://apps.facebook.com/street-fights/bank.php";
var page = "";
if(location.href == job){
page = "job";
}else{
page = "bank";
}

/*****************/
//樣板 template
function template_sf_info(){//sfobj.my_data['level']
this.template_info_data;
//this.template_info_data = sfobj.my_data['level'];
//alert(my_data['level']);
//location.href
template_info_data = "";
template_info_data += "";
template_info_data += "";
template_info_data += ""
template_info_data += "";
template_info_data += ""
template_info_data += "";
template_info_data += "";
template_info_data += ""
template_info_data += ""
template_info_data += ""
template_info_data += ""
template_info_data += ""
template_info_data += "
義氣仔女Online, 頁面:"+ page +"
功能:任務,存錢
修改自neo@orz.hk,by CX
等級:" + sfobj.my_data['level']+"
體力:" + sfobj.my_data['en']+"
剩下:" + sfobj.my_data['-exp']+"經驗值
生命:" + sfobj.my_data['hp']+"
現金:" + sfobj.now_money+"
執行任務:" + sfobj.renwu_selece_id+"
體力上線:" + sfobj.renwu_selece_reg+"
自動存款:" + sfobj.money+"
更新時間:" + sfobj.time+" (S)"+"
";

return this.template_info_data;
}
function template_sf_set(){
var template_set_data;
template_set_data = "
";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "";
template_set_data += "
義氣仔女Online______設定
任務:
體力:
自動存款:
更新時間:
啟動自動任務
啟動自動存款
";
return template_set_data;
}

function div_template(id){
var backgroundcolor = '#ffeeee';
this.htmlElement = document.createElement('div');
this.htmlElement.id = id;
this.htmlElement.style.top = '56px';//向上的高度
this.htmlElement.style.right = '2px';
this.htmlElement.style.position = 'absolute';
this.htmlElement.style.width = '160px';
this.htmlElement.style.height = '230px';
this.htmlElement.style.background = backgroundcolor;
this.htmlElement.style.font = '11px arial';
this.htmlElement.style.color = 'grey';
this.htmlElement.style.textAlign = 'center';
this.htmlElement.style.zIndex = 100;
this.run = function() { //obj is window
//alert(this.htmlElement.zIndex);
//window.parent.document.body.appendChild(this.htmlElement);
window.parent.document.body.appendChild(this.htmlElement);
};
};

function sf_obj(){
this.action = null;
this.action_link = null;
this.env = null;
this.renwu_selece_id = 5;//修改任務
this.renwu_selece_reg = 10;//修改體力
this.htmldata = "";
this.my_info = new Array(20);
this.my_data = new Array(20);
this.money = 1000;
this.ren_io = false;
this.money_io = false;
this.time = 30000;
this.get_my_info = function(htdata){

//this.str = new RegExp('現金:[^v]+').exec(document.getElementById('app17326627347_main').innerHTML);
this.str = new RegExp('現金:[^v]+').exec(htdata);

//this.my_info['cash'] = parseInt(sf_str.toString(10).split('$')[1].split('<')[0].replace(/,/g,""),10);
this.now_money = parseInt(this.str.toString(10).split('$')[1].split('<')[0].replace(/,/g,""),10);
//alert(this.now_money);
this.str = null;

this.my_info['level'] = htdata.match(/等級:<\/span>([0-9]{1,3})/);
this.my_info['exp'] = htdata.match(/EXP:<\/span>([0-9]{1,10})\/([0-9]{1,10})/);
this.my_info['hp'] = htdata.match(/生命:<\/span>([0-9]{0,10})\/([0-9]{1,3})/);
this.my_info['sta'] = htdata.match(/精神:<\/span>([0-9]{0,10})\/([0-9]{1,3})/);
this.my_info['en'] = htdata.match(/體力:<\/span>([0-9]{1,3})\/([0-9]{1,3})/);
//this.my_info['cash'] = htdata.match(/現金:<\/span>\$(.*?)<\/span>/);
this.my_info['cash'] = this.now_money;

this.my_info['level'][1] = parseInt(this.my_info['level'][1]);
this.my_info['hp'][1] = parseInt(this.my_info['hp'][1]);
this.my_data['level'] = this.my_info['level'][1];
this.my_data['exp'] = this.my_info['exp'][1];
this.my_data['-exp'] = this.my_info['exp'][2] - this.my_info['exp'][1];
this.my_data['hp'] = this.my_info['hp'][1];
this.my_data['hp_all'] = this.my_info['hp'][2];
this.my_data['sta'] = this.my_info['sta'][1];
this.my_data['en'] = this.my_info['en'][1];
this.my_data['cash'] = this.my_info['cash'][1];
//alert(this.my_data['cash']);
};
this.Renwu = function(id_exit){//0 is exit
if(page != "job"){return 0;}
//alert("p"+this.renwu_selece_reg);
//if(!this.renwu_selece_reg){return this.renwu_selece_reg;}
//alert("p"+this.my_data['en']);
if(this.my_data['en'] >= this.renwu_selece_reg && this.my_data['en'] != null){
this.action = document.getElementById('app17326627347_mod_action-' + this.renwu_selece_id);
if(this.action.getElementsByTagName('a')[0] == null){location.href = job;}
this.action_link = this.action.getElementsByTagName('a')[0];
this.evt = document.createEvent("MouseEvents");
this.evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
this.action_link.dispatchEvent(this.evt);
}
}
this.save_money = function(id_exit){//0 is exit
if(page != "bank"){return 0;}
if (document.getElementsByName("amount").length > 1) {
document.getElementsByName("deposit")[0].click();
//alert("m");
return;
}
}
};

function post(url, data, cb) {
GM_xmlhttpRequest({
method: "POST",
url: url,
headers:{'Content-type':'application/x-www-form-urlencoded'},
data:encodeURI(data),
onload: function(xhr) { cb(xhr.responseText); }
});
}
/*ex
post('http://www.flash-mx.com/mm/viewscope.cfm', 'userid=joe&password=guessme', function(text) {
alert('HTML of the page:' + text)
})
*/
var last_check = new Date();
var sfobj = new sf_obj();
var div1 = new div_template("window1");
div1.run();

//sfobj.save_money();

function cx_run(){
GM_xmlhttpRequest({
method: 'GET',
url: 'http://apps.facebook.com/street-fights/job.php',
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
},
onload: function(responseDetails) {
var html_data = responseDetails.responseText;
sfobj.get_my_info(html_data);//1
//alert(sfobj.my_info['level']);
//alert(sfobj.my_data['level']);
//get_my_info(html_data);
//Renwu();
var tmp1 = sfobj.now_money;
var tmp2 = sfobj.money;
//alert(tmp1+" : "+tmp2);
//alert(tmp1 > tmp2);
if(sfobj.now_money > sfobj.money){
if(page != "bank"){
location.href = bank;
//alert("t0");
}
sfobj.save_money();
//alert("t1");
}else if(sfobj.now_money != null){
//alert("t3");
if(page != "job"){location.href = job;}
sfobj.Renwu();
}
/*
var now_date =new Date();
last_check = now_date;
now_date = null;
*/
//window.setTimeout(function() { cx_run(); }, 30000);
}
});
}

function main_fun(){
var current = new Date();
var seconds = (current - last_check) / 1000;
sfobj.time = parseInt(30-seconds);
if(sfobj.time <= 0){
last_check = current;
window.setTimeout(function() { cx_run(); }, 500);
}

div1.htmlElement.innerHTML = template_sf_info();
window.setTimeout(function() { main_fun(); }, 1000);
}

div1.htmlElement.innerHTML = '
Initializing . . .' ;
//*****htmlElement.innerHTML = '
Initializing . . .' ;
window.setTimeout(function() { cx_run(); }, 500);
window.setTimeout(function() { main_fun(); }, 1000);