//*******************************************
//* *
//* http://tofu2.com/ *
//* とうふつーの森用 *
//*******************************************
document.scroll = function(){
return {
left: this.body.scrollLeft || this.documentElement.scrollLeft,
top: this.body.scrollTop || this.documentElement.scrollTop
}
}
//---- COPY
function copy(copy_Str,alert_Str){
clipboardData.setData('Text',copy_Str);
if(alert_Str.length>0)alert(alert_Str);
}
//---- BLOG TAG
function blogTag(tag_Str){
var str;
str="";
str+=tag_Str;
return str;
}
function getLeft(obj){
return (!obj.style.pixelLeft)?obj.style.left.toString().replace(/px/,"")*1:obj.style.pixelLeft;
}
function getTop(obj){
return (!obj.style.pixelTop)?obj.style.top.toString().replace(/px/,"")*1:obj.style.pixelTop;
}
function getPageX(e){
if(!e)var e=event;
return e.pageX | document.body.scrollLeft+e.x;
}
function getPageY(e){
if(!e)var e=event;
return e.pageY | document.body.scrollTop+e.y;
}
//********** IMG **********
//---- IMG TAG COPY
function imgTagCopy(){
var i;
for(i in document.getElementsByTagName("img")){
document.getElementsByTagName("img")[i].onclick=
function(){
var str="
";
str=str.replace(/src="gif/ig,'src="'+document.domain+'/gif');
copy(str,"copy("+str+")");
}
}
}
//---- IMG MOVE TO
function imgMoveTo(img_Obj,x_Int,y_Int){
img_Obj.style.position="absolute";
img_Obj.style.top=y_Int;
img_Obj.style.left=x_Int;
}
//---- IMG MOVE BY
function imgMoveBy(img_Obj,x_Int,y_Int){
img_Obj.style.position="absolute";
img_Obj.style.top=getTop(img_Obj)+y_Int;
img_Obj.style.left=getLeft(img_Obj)+x_Int;
}
//---- img MOUSE STALKER
function imgMouseStalker(){
var i;
// try{
imgMoveBy(arguments[1],(getPageX(arguments[0])-getLeft(arguments[1]))/30,(getPageY(arguments[0])-getTop(arguments[1]))/20);
i=2;
while(arguments[i]){
imgMoveBy(arguments[i],(getLeft(arguments[i-1])-getLeft(arguments[i]))/20,(getTop(arguments[i-1])-getTop(arguments[i]))/20);
i++;
}
// }catch(e){}
}
//---- MOUSE STALKER
function mouseStalker(obj,m){
if(!m)var m=1;
var x;
var y;
if(document.scroll().left+event.x-arguments[0].style.pixelLeft==0){
x=0;
}else if(document.scroll().left+event.x-arguments[0].style.pixelLeft>0){
x=m;
}else{
x=-m;
}
if(document.scroll().top+event.y-arguments[0].style.pixelTop==0){
y=0;
}else if(document.scroll().top+event.y-arguments[0].style.pixelTop>0){
y=m;
}else{
y=-m;
}
imgMoveBy(obj,x,y);
}
//==== imgKurukuru OBEJCT
imgKurukuru_Obj=[];
function imgKurukuru(Id_str){
if(typeof(Id_str)=="object"){
this.obj=Id_str;
Id_str=imgKurukuru_Obj.length+102102;
}
imgKurukuru_Obj[Id_str]=this;
this.id=Id_str;
this.style=new Object();
this.style.left=300;
this.style.top=300;
this.position="";
this.speed=3;
this.zoom=3;
this.actType=0;
this.count=0;
}
//==== imgZoomzoom OBJECT
imgZoomzoom_Obj=[];
function imgZoomzoom(Id_str){
if(Id_str.toString().indexOf("object",0)>-1){
this.obj=Id_str;
Id_str=imgZoomzoom_Obj.length+102102;
}
imgZoomzoom_Obj[Id_str]=this;
this.id=Id_str;
this.style=new Object();
this.style.zoom=1;
this.style.left=300;
this.style.top=300;
this.position="";
this.max=2;
this.min=.5;
this.count=1;
this.speed=1;
this.direction=1;
}
//********** INTERVAL **********
//---- KURUKURU INTERVAL
function kurukuruStart(interval){
if(!interval)interval=100;
kurukuru_Intrerval=setInterval("kurukuru_tick()",interval);
}
function kurukuru_tick(){
var i,x,y,img_Obj;
for(i in imgKurukuru_Obj){
obj=imgKurukuru_Obj[i];
obj.count+=obj.speed/10;
x=obj.style.top+Math.sin(obj.count)*10*obj.zoom;
y=obj.style.pixelTop+Math.cos(obj.count)*10*obj.zoom;
if(!obj.obj){
img_Obj=document.getElementById(obj.id);
}else{
img_Obj=obj.obj;
}
imgMoveTo(img_Obj,x,y);
}
}
//---- ZOOMZOOM INTERVAL
function zoomzoomStart(interval){
if(!interval)interval=100;
zoomzoom_Intrerval=setInterval("zoomzoom_tick()",interval);
}
function zoomzoom_tick(){
var i,img_Obj;
for(i in imgZoomzoom_Obj){
obj=imgZoomzoom_Obj[i];
if(obj.count>obj.max)obj.direction=-1;
if(obj.countobj.max)obj.direction=-1;
if(obj.count-1){
count++;
if(numberInt==count){
return tag[i];
}
i++;
continue;
}
}
if(tag[i].innerHTML){
if(tag[i].innerHTML.replace(/<.+>/,"").indexOf(txtStr)>-1){
count++;
if(numberInt==count){
return tag[i];
}
i++;
continue;
}
}
if(tag[i].src){
if(tag[i].src.indexOf(txtStr)>-1){
count++;
if(numberInt==count){
return tag[i];
}
i++;
continue;
}
}
if(tag[i].href){
if(tag[i].href.indexOf(txtStr)>-1){
count++;
if(numberInt==count){
return tag[i];
}
i++;
continue;
}
}
i++;
}
return "";
}
//---- P SET
pset=pSet;
function pSet(xInt,yInt,colorStr,pointStr,screenObj,posStr){
if(!posStr)posStr="absolute";
if(!colorStr)colorStr="black";
if(!pointStr)pointStr=".";
var obj;
if(!screenObj)screenObj=document.body;
obj=document.createElement("div");
obj.style.position=posStr;
obj.style.left=xInt;
obj.style.top=yInt;
obj.innerHTML=pointStr
obj.style.color=colorStr;
screenObj.appendChild(obj);
return obj;
}
//---- line
function line(x1,y1,x2,y2,colorStr,pointStr,box,step,screenObj){
var i;
if(!step)step=1;
if(!colorStr)colorStr="black";
if(!pointStr)pointStr=".";
if(x1>x2){
var xx=x2;
x2=x1;
x1=xx;
var yy=y2;
y2=y1;
y1=yy;
}
var x;
var y;
var ax=x2-x1;
var ay=y2-y1;
var a=ay/ax;
if(ax>ay){
for(i=0;iendDegree){
if(startDegree>360)return;
endDegree+=360;
}
startRad=startDegree*pi/180-pi;
endRad=endDegree*pi/180-pi;
for(i=startRad;i
");
}
//--- HIT TEST
function hitTest(x,y,obj){
if(!obj)return;
var top=obj.getBoundingClientRect()['top'];
var bottom=obj.getBoundingClientRect()['bottom'];
var left=obj.getBoundingClientRect()['left'];
var right=obj.getBoundingClientRect()['right'];
if(x>=left && x<=right && y>=top && y<=bottom){
return true;
}
return false;
}
//---- objHitTest
function objHitTest(obj1,obj2){
try{
var top1=obj1.getBoundingClientRect()['top'];
var bottom1=obj1.getBoundingClientRect()['bottom'];
var left1=obj1.getBoundingClientRect()['left'];
var right1=obj1.getBoundingClientRect()['right'];
var top2=obj2.getBoundingClientRect()['top'];
var bottom2=obj2.getBoundingClientRect()['bottom'];
var left2=obj2.getBoundingClientRect()['left'];
var right2=obj2.getBoundingClientRect()['right'];
if(top1<=bottom2 && bottom1>=top2 && left1<=right2 && right1>=left2){
return true;
}
}catch(e){}
return false;
}
function getBounds(obj,str){
if(str=="left" || str=="right"){
return obj.getBoundingClientRect()[str]+document.scroll().left;
}
if(str=="top" || str=="bottom"){
return obj.getBoundingClientRect()[str]+document.scroll().top;
}
}
//==== map
function map(){
this.tip=new Object()
this.data="";
this.tip.data=[];
this.tip.width=45;
this.tip.height=45;
this.top=0;
this.left=0;
this.tips=[];
for(i=0;i<10;i++){
this.tips[i]=[];
}
this.write=function(){
var i;
var x=this.left;
var y=this.top;
for(i=0;i');
document.body.onmousemove=function(e){
px=getPageX(e);
py=getPageY(e);
}
setInterval(function(){
var x=m.style.left-px;
var y=m.style.top-py;
if(x>0){
m.obj.firstChild.style.filter="FlipV();";
}else{
m.obj.firstChild.style.filter="";
}
m.rotate(atan2(x,y)+Math.PI/2);
m.style.left-=x/15;
m.style.top-=y/15;
},100)
}
//****************
function open_homepy(str){
homepy=window.open(str, '_homepy', 'scrollbars=yes,resizable=yes,width=1020,height=620');
homepy.focus();
}
function dc(obj){
obj.style.background='white';
obj.style.color='black';
}