星期三, 12月 02, 2009

matlab 2009 12/03 w01


% program file w1_20091203.m
clear all;
close all;
x_n = [2 1 1/2 1/4];
nx = [-1 0 1 2];
h_n = [1 1 1 1 ];
nh = [0 1 2 3];
y_n = conv(x_n,h_n);
y_n2 = conv(h_n,x_n);

n0 = nx(1) + nh(1);
N = length(nx)+length(nh)-1;
n = n0:n0 + N-1;

subplot(211);
stem(n,y_n,'b');
grid;

subplot(212);
stem(n,y_n2,'r');
grid;

matlab 2009 12/03 w01


% program file w1_20091203.m
clear all;
close all;
n_x = [2 1 1/2 1/4];
nx = [-1 0 1 2];
h_n = [1 1 1 1 ];
nh = [0 1 2 3];
y_n = conv(n_x,h_n);

n0 = nx(1) + nh(1);
N = length(nx)+length(nh)-1;
n = n0:n0 + N-1;

subplot(111);
stem(n,y_n,'b');
grid;

星期三, 11月 18, 2009

matlab 2009 11/19 02


% program file lab20091119w1.m
clear all;
clf;
x_n = 10*ones(1,800);
r = 2;
l = 1;
ts = 0.01;
a = [1/ts + r/l -1/ts];
b = [1/l];
y_n = filter(b,a,x_n);
n = 0:1:800-1;

l2= 5;
a2 = [1/ts + r/l2 -1/ts];
b2 = [1/l2];
y2_n = filter(b2,a2,x_n);

x2_n = 10*(n>=50);
y2_n = filter(b2,a2,x2_n);

subplot(211);
stem(n,x2_n,'b');
grid;
subplot(212);
stem(n,y2_n,'b');
grid;


matlab 2009 11/19 01


% program file lab20091119w1.m
clear all;
clf;
x_n = 10*ones(1,400);
r = 2;
l = 1;
ts = 0.01;
a = [1/ts + r/l -1/ts];
b = [1/l];
y_n = filter(b,a,x_n);
n = 0:1:400-1;

subplot(211);
stem(n,x_n,'b');
grid;
subplot(212);
stem(n,y_n,'b');
grid;

星期四, 10月 29, 2009

matlab 2009 10/29 02


% program file lab2009102901.m
clear all;
clf;
tf = 1;
dt = 0.01;
t =0:dt:1;
x1 = cos(2*pi*10*t);
x2 = cos(2*pi*35*t);

fs1 = 2*35;
xc = x1+x2;
ts1 = 1/fs1;
n1 = 0/ts1:1:tf/ts1;
x1_n = cos(2*pi*10*ts1)+cos(2*pi*35*n1*ts1);

subplot(411);
plot(t,x1,'r');
grid;
subplot(412);
plot(t,x2,'g');
grid;
subplot(413);
plot(t,xc,'g');
grid;
subplot(414);
stem(n1,x1_n,'b');

matlab 2009 10 29 01


% program file lab2009102901.m

clear all;
clf;

dt = 0.01;
t =0:dt:5;
x1 = cos(2*pi*10*t);
x2 = cos(2*pi*35*t);


subplot(311);
plot(t,x1,'r');

subplot(312);
plot(t,x2,'g');

subplot(313);
%stem(n,x_n,'b');

星期四, 10月 22, 2009

matlab 2009 10 22 02


% program file lab2009102202.m
clear all;
% clf;
dt = 0.0001;
t =-0.01:dt:0.02;
xc = cos(2*pi*100*t);
tt = 0.0005;
ts = -0.01:tt:0.02;
xd = cos(2*pi*100*ts);

n=-20:1:40;
x4 = cos(2*pi*100*n*tt);

figure(1);
subplot(311);
plot(t,xc);

subplot(312);
stem(ts,xd);

subplot(313);
stem(n,x4);

星期三, 10月 21, 2009

matlab 2009 10 22 01


% program file lab2009102201.m
clear all;
clf;
dt = 0.001;
t =-0:dt:0.1;
s = 5+4*cos(2*pi*20*t);
xc1 = cos(2*pi*200*t);
x1 = s.*xc1;

xc2 = cos(2*pi*700*t);
x2 = s.*xc2;

figure(1);
subplot(311);
plot(t,s,'x');grid;hold on;
plot(t,xc1,'g');

subplot(312);
plot(t,x1);

subplot(313);
plot(t,x2);

星期一, 10月 19, 2009

8051 w2


#pragma oe db pw(80) SM SB CD
#include
#include "Delay.h"
main(){
int num = 0;
char State=0;
P2 =0x3f;

for(;num<6;){
Delay1s();
if(State == 1){
P2 <<= 1;
P2 |=0x01;
}
if(State == 0){
P2 >>= 1;
P2 |=0x80;
}

if((P2&0xc0)==0){//0011 1111 + 1100 0000 =0
State= 0;
num++;
}
if((P2&0x03)==0){
State= 1;
num++;
}
}

for(;;);
}

8051 w2


#pragma oe db pw(80) SM SB CD
#include
#include "Delay.h"
main(){
int num = 0;
char State=0;
P2 =0x3f;

for(;num<6;){
Delay1s();
if(State == 1){
P2 <<= 1;
P2 |=0x01;
}
if(State == 0){
P2 >>= 1;
P2 |=0x80;
}

if((P2&0xc0)==0){//0011 1111 + 1100 0000 =0
State= 0;
num++;
}
if((P2&0x03)==0){
State= 1;
num++;
}
}

for(;;);
}

8051 led2


#pragma oe db pw(80) SM SB CD
#include
void Delay1s(void){ //時間延遲一秒的函數
ACC = 5;
F0 = 1;
F0 = 1;
F0 = 1;
}
main(){
int num = 0; //宣告用來表示次數的變數
char State=0; //宣告檢測右邊和左邊的變數
P0 =0xc0; //初始設定左邊2個點燈是亮的
for(;num<6;){ //來回跑3次的設定
Delay1s(); //時間暫停一秒
if(State == 0) P0 >>= 1; //當電燈到達左邊2個發光時,開始向右邊跑
if(State == 1) P0 <<= 1; //當電燈到達右邊2個發光時,開始向左邊跑
if((P0&0x3f)==0){ //當電燈到達左邊時
State= 0; //檢測變數會改變為 左
num++; //開始算一次
}
if((P0&0xfc)==0){ //當電燈到達右邊
State= 1; //檢測變數會改變為 右
num++; //開始算一次
}
}
for(;;);//讓程式進入無限回圈
}

星期日, 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);

星期三, 10月 14, 2009

matlab 2009101501


% program file lab2009101501.m
clear all;
t = -0.05:0.001:0.05;
x1 = 10;
x2 = 14*cos(2*pi*100*t-pi/3);
x3 = 8*cos(2*pi*250*t+pi/2);
x4 = x1 + x2 + x3;

subplot(411);
plot(t,x1);


subplot(412);
plot(t,x2);


subplot(413);
plot(t,x3);


subplot(414);
plot(t,x4);

星期二, 10月 13, 2009

8051 led


#pragma oe db pw(80) SM SB CD
#include
#include "Delay.h"
code tbl1[]= { 0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf } ;
int num= 0;

int main()
{
char i ;
int id = 0;
/*P0 =0x01;*/
P0 =0xc0;
/*P0 =0x80;*/

for(num = 0;num<=6;){
Delay100ms() ;
P3 = num;
if((P0&0x3f) == 0){ /*0x01*/
num++;
id = 1;
}
if((P0&0xfc) == 0){ /*0x80*/
num++;
id = 0;
}
if(id == 0){
P0 <<=1 ;
}else{
if(num<6) P0 >>=1 ;
}
}
Delay1s() ;
Delay1s() ;
Delay1s() ;
Delay1s() ;

/*P0 >>=1;*/
/*P0=tbl1[1];*/
/*
for(;;) {
for(i = 0 ; i < 14 ; i++ ){
P0=tbl1[i] ;
Delay100ms() ;
}
}
*/
return 0;

}

星期四, 10月 08, 2009

matlab lab 20091008 1


% program file lab200910081.m
clear all;
k = 0;
tt = 0:0.01:10;

for t=0:0.01:10
k = k + 1;
x1(1,k) = cos(2*pi*0.5*t);
x2(1,k) = sin(2*pi*5*t);
x3(1,k) = x1(1,k)*x2(1,k);
end
subplot(311);
plot(tt,x1);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(312);
plot(tt,x2);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(313);
plot(tt,x3);
xlabel('t,(s)');
ylabel('x(t)');
grid;

星期三, 9月 30, 2009

matlab 100101


% program file lab100101.m
clear all;
a=10;
ts = 0.001;
t1 = -0.5:ts:0.5;
x1 = a*cos(2*pi*5*t1);

ts2 = 0.05;
t2 = -0.5:ts2:0.5;
x2 = a*cos(2*pi*5*t2);

ts3 = 0.01;
t3 = -0.5:ts3:0.5;
x3 = a*cos(2*pi*5*t3);

subplot(311);
plot(t1,x1);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(312);
stem(t2,x2);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(313);
stem(t3,x3);
xlabel('t,(s)');
ylabel('x(t)');
grid;

星期三, 9月 23, 2009

【matlab】 090924work

matlab work2

% program file lab092401.m
clear all;

dt = 0.01;
w = 2;
a = 10;
k = 0;
for t = -10:dt:10
k = k+1;
x(1,k) = a * cos(w*t);
end
tt = -10:dt:10;
plot(tt,x);

% t = -10:dt:10;
% a = 10;
% x = a * cos(w*t);
% plot(t,x);

xlabel('t,(s)');
ylabel('x(t)');
grid;



% program file lab092402.m
dt = 0.01;
w = 2;
t = -10:dt:10;
a = 10;
x1 = a * cos(w*t);
td = -0.5;
x2 = a * cos(w*(t+td));
subplot(211);
plot(t,x1);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(212);
plot(t,x2);

xlabel('t,(s)');
ylabel('x(t)');
grid;



% program file lab092403.m
clear all;
dt = 0.01;
w = 2;
t = -10:dt:10;
a = 10;
x1 = a * cos(w*t);
td = -0.5;
x2 = a * cos(w*(t+td));

subplot(311);
plot(t,x1);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(312);
plot(t,x2);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(313);
%figure(2);
plot(t,x1,'r');
hold on;
plot(t,x2,'g');
xlabel('t,(s)');
ylabel('x(t)');
grid;

星期日, 9月 20, 2009

【Blogger】SyntaxHighlighter 2.0

在 http://spenthil.com/2009/04/12/syntaxhighlighter-2-0-on-blogger/
有些說明。





< pre class=" brush: [語法]"></pre>

義氣仔女 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);