( function ( w , d ) {
var topage = 2;
if ( topage < 1 ) topage=2
function imp () {
this.elem = d.getelementbyid ( 'showdata' ) ,
this.imp0 = function ( url ) {
$( "ul.page_list" ).css( "display" , "none" );
d.getelementbyid ( 'pagemore' ).style.display = 'none';
var flag = 1;
var tthis = this;
var height = win.height() + 200;
events.add( w , 'scroll' , function () {
if ( tthis.elem.getboundingclientrect().bottom <= height && flag ) {
flag = 0;
var a = new xmlhttprequest;
a.onreadystatechange = function () {
if ( this.readystate == 4 && this.status == 200 ) {
tthis.elem.innerhtml += '
' + this.responsetext + '
' ;
topage++;
flag = 1;
}
}
a.open ( 'post' , url + "&topage=" + topage , true );
a.send();
}
} );
} ,
this.imp1 = function ( url ) {
$( "ul.page_list" ).css( "display" , "none" );
var pagemore = d.getelementbyid ( 'pagemore' );
var tthis = this;
pagemore.onclick = function () {
pagemore.innerhtml = 'loading...';
pagemore.style.background = 'url(http://limengqun.top/img/loading.gif) no-repeat 20% center , #ccc';
var a = new xmlhttprequest;
a.onreadystatechange = function () {
window.water._addchild_( 'showdata' , {
lg:4 ,
sm:2 ,
width :1000 ,
margin:12
} );
if ( this.readystate == 4 && this.status == 200 ) {
tthis.elem.innerhtml += this.responsetext ;
window.water._addchild_( 'showdata' , {
lg:4 ,
sm:2 ,
width :1000 ,
margin:12
} );
w.chousesatodo( w.chousesas( tthis.elem.getelementsbytagname( 'a' ) ) );
w.sethows();
topage++;
if ( this.responsetext.length <= 200 ) {
pagemore.style.display = 'none';
}
}
}
a.open ( 'post' , url + "&topage=" + topage , true );
a.send();
};
} ,
this.imp2 = function () {
d.getelementbyid ( 'pagemore' ).style.display = 'none';
}
};
w.autoload = new imp();
var phones = function () {
var a = d.getelementsbytagname( 'a' );
function chouse ( a ) {
var len = a.length ,
el = [];
for ( var i = 0 ; i < len ; i++ )
if ( typeof a[ i ].getattribute( 'l-type' ) == 'string' )
el.push( a[ i ] );
return el;
};
function todo ( a ) {
var len = a.length;
for ( var i = 0 ; i < len ; i++ ) {
if ( a[ i ].getattribute( 'l-type' ) == '1' && !a[ i ].endaddstrong ) {
a[ i ].onmouseenter = enter;
a[ i ].endaddstrong = true;
}
if ( a[ i ].getattribute( 'l-type' ) != '0' ) {
a[ i ].onclick = stops;
}
}
};
todo( chouse ( a ) );
function enter ( e ) {
if ( !this.getelementsbytagname( 'strong' ).length ) {
this.strongelem = d.createelement( 'strong' ) ,
_this = this;
css( _this.strongelem , {
'position' : 'absolute' , 'top' : '0' , 'left' : '0' , 'bottom' : '0' , 'right' : '0' , 'zindex' : '9' , 'background' : 'rgba(0,0,0,.5)' , 'opacity' : '0' ,
'visibility' : /*'visible'*/ 'hidden' , 'transition' : 'all .3s'
} );
new qrcode( _this.strongelem , {
width : 180 ,
height : 180 ,
text : 'http://' + _this.getattribute( 'l-href' ).split( '|' ).pop()
} );
this.appendchild( _this.strongelem );
}
};
function stops ( e ) {
e = e || w.event;e.preventdefault();
};
w.chousesas = chouse;
w.chousesatodo = todo;
}();
( function () {
function sethow() {
if ( !d.getelementbyid( 'showdata' ) ) return ;
var showdata = d.getelementbyid( 'showdata' ).getelementsbytagname( 'a' ) ,
listclasss = oclass.get( 'listclass' )[ 0 ].getelementsbytagname('div'),
listclass = [];
for (var i = 0; i < listclasss.length; i++) {
var a = listclasss[ i ].getelementsbytagname( 'a' );
for (var j = 0; j < a.length; j++) {
listclass.push( a[ j ] );
}
};
for (var i = 0; i < showdata.length; i++) {
for (var j = 0; j < listclass.length; j++) {
if ( (showdata[ i ].getattribute( 'l-lei' ) == listclass[ j ].getattribute( 'href' ).split( '=' ).pop()) && !showdata[ i ].getelementsbytagname( 'b' ).length ) {
showdata[ i ].getelementsbytagname( 'em' )[ 0 ].getelementsbytagname( 'span' )[ 0 ].innerhtml += '' + listclass[ j ].parentnode.parentnode.children[ 0 ].innerhtml + '';
showdata[ i ].getelementsbytagname( 'em' )[ 0 ].getelementsbytagname( 'span' )[ 1 ].innerhtml += '' + listclass[ j ].innerhtml + '';
};
};
};
};
sethow();
w.sethows = sethow;
} () );
( function () {
function waterfall () {}
waterfall.prototype._addchild_ = function ( id , width , n ) {
this.n = n;
if( !document.getelementbyid( id ) ) {
return;
}
this.elem = document.getelementbyid( id ) ,
css( this.elem , {
'position' : 'relative'
} );
this.child_node = this.elem.children;
var winwidth = win.width();
width = {
marginright : 15,
marginbottom : 15,
width : this.elem.offsetwidth,
row:4
};
if ( winwidth <= 1200 && winwidth > 680 ) {
width.row = 3;
width.marginright = 10;
width.marginbottom = 10;
} else if ( winwidth <= 680 ) {
width.row = 2;
width.marginright = 6;
width.marginbottom = 6;
};
window.waterbasic = width;
this.resize ( this.child_node , width );
this.type ( this.child_node , width );
}
waterfall.prototype.type = function ( elem , width ) {
var length = elem.length ,
parent = elem[ 0 ].parentnode ,
parentimg = parent.getelementsbytagname ( 'img' );
var pagemore = d.getelementbyid( 'pagemore' );
var basic = width;
var width = basic.width / basic.row - basic.marginright * 2;
var i ,
elemarray = new array ( basic.row ) ,
min = 0 ,
ready = 0 , cur = 0;
var t = this;t.height = 0;
clearinterval ( timer );
var timer = setinterval ( function () {
ready = 0;
for ( i = 0 ; i < parentimg.length ; i++ ) if ( parentimg[ i ].complete ) ready++;
if ( cur != ready ) start();
if ( ready == parentimg.length ) {
clearinterval ( timer );
settimeout( function () {
pagemore.innerhtml = 'more+';
pagemore.style.background = '#ff7e25';
start();
} , 700 );
this.n && this.n();
};
cur = ready;
} , 30 );
function start () {
for ( i = 0 ; i < basic.row ; i++ ) elemarray[ i ] = 0;
for ( i = 0 ; i < length ; i++ ) {
min = _min_ ( elemarray );
elem[ i ].style.csstext = 'opacity:1;position:absolute;width:' + width + 'px;top:' + elemarray [ min ] + 'px;left:' + ( min * width + ( min * 2 ) * basic.marginright ) + 'px';
elemarray [ min ] += elem[ i ].offsetheight + basic.marginbottom * 2;
}
var hei = elemarray[ _max_ ( elemarray ) ];
if ( t.height <= hei ) {
t.height = hei;
parent.style.height = hei + 'px';
};
}
}
waterfall.prototype.resize = function ( c , width ) {
if ( this.resezefs ) return;
this.resezefs = true;
var t = this;
width = {
marginright : 15,
marginbottom : 15,
width : this.elem.offsetwidth,
row: 4
};
var _this = this;
events.add( window , 'resize' , function () {
cleartimeout( _this.timer );
var winwidth = win.width();
width.width = _this.elem.offsetwidth;
_this.timer = settimeout( function () {
if ( winwidth <= 1200 && winwidth > 680 ) {
width.row = 3;
width.marginright = 10;
width.marginbottom = 10;
} else if ( winwidth <= 680 ) {
width.row = 2;
width.marginright = 6;
width.marginbottom = 6;
};
t.type ( c , width );
} , 200 );
} );
}
function _min_ ( arr ) {
let maxnub = 0;
for ( var i = 1 ; i < arr.length ; i++ ) {
if ( arr[ i ] < arr[ maxnub ] ) {
maxnub = i;
}
}
return maxnub;
}
function _max_ ( arr ) {
let maxnub = 0;
for ( var i = 1 ; i < arr.length ; i++ ) {
if ( arr[ i ] > arr[ maxnub ] ) {
maxnub = i;
}
}
return maxnub;
}
window.water = new waterfall();
var timer = setinterval( function () {
window.water._addchild_( 'showdata' );
} , 1500);
} )();
} ( window , document ));