return false;
}

if(isMobile() && window.location.host.toLowerCase() != MHOST && document.referrer.indexOf('diyiapp.com') == -1) {
var url = $('meta[name=mobile-agent][content*=html5]').attr('content');
if(defined(url)) {
url = url.match(/url=(http\:\/\/[^ ]+)/i);
if(url.length > 1) window.location.href = url[1];
}
}



/************************* http://www.diyiapp.com/templets/tan/javascript/s3/common_mobi.js *************************/

function initSwipe(swipe, dot, auto){
if(typeof(swipe) == 'undefined' || swipe.length == 0) return;
if(typeof(auto) == 'undefined') auto = 5000;
swipe = swipe[0];
var s = 0;
if(typeof(swipe.slider) != 'undefined') {
s = swipe.slider.getPos();
swipe.slider.kill();
}
swipe.slider = new Swipe(swipe, {
'startSlide': s,
'speed': 300,
'auto': auto,
'continuous': true,
'disableScroll': false,
'stopPropagation': true,
'callback': function(index, elem) {
if(typeof(dot) != 'undefined')
dot.children().removeClass('cur').eq(index % dot.children().length).addClass('cur');
},
'transitionEnd': function(index, elem) { win.trigger('scroll'); }
});
if(typeof(dot) != 'undefined') dot.children().each(function(i, n){
$(n).click(function(){
swipe.slider.slide(i);
});
});
}

function initScale(obj, callback, auto){
var s = parseFloat(obj.attr('scale'));
var b = obj.attr('scale-by');
if(typeof(b) != 'undefined') b = b.toLowerCase();
auto = typeof(auto) == 'undefined' ? true : auto;
if(s > 0.0) {
var exec = function() {
var w = obj.width();
var h = obj.height();
if(b == 'height') obj.css('width', h * s);
else if(b == 'width') obj.css('height', w / s);
if(typeof(callback) == 'function') callback(obj);
}
exec();
if(auto != false) win.bind('resize', exec);
}
}

function initTabView(obj){
initSwipe(obj.find('.view'), obj.find('.tab'), 1000000);
}

function initD(){
var device = 'pc';
if(isAndroid()) device = 'android';
else if(isIOS()) device = 'ios';

var down = function(url, tips){
if(device == 'ios' && typeof('iosdownurl') != 'undefined') {
window.open(iosdownurl);
}
else {
window.open(url);
}
if(tips != '0') {
var html = '';
var data = $('.elite>ul.app');
if(data.length > 0) {
html = data.html();
html = $('<div><ul class="tipselite app">' + html + '</ul></div>');
html.find('li').slice(0, 1).slice(4).remove();
html.find('a').removeAttr('r');
html = html.html();
showDialog('澶у杩樺畨瑁呬簡', html);
initD();
}
}
}

var downAndroid = function(){
var n = $(this);
down(n.attr('android'), n.attr('tips'));
return false;
}

var downIOS = function(){
var n = $(this);
down(n.attr('ios'), n.attr('tips'));
return false;
}

var downItunes = function(){
var n = $(this);
down('http://itunes.apple.com/cn/app/id' + n.attr('itunesid') + '?mt=8', n.attr('tips'));
return false;
}

var downPage = function(){
var n = $(this);
down(n.attr('down'), n.attr('tips'));
return false;
}

$('.d[r!=1]').each(function(i, n){
n = $(n);
if(device == 'android' && typeof(n.attr('android')) != 'undefined' && n.attr('android') != '') n.click(downAndroid);
else if(device == 'ios' && typeof(n.attr('ios')) != 'undefined' && n.attr('ios') != '') n.click(downIOS);
else if(device == 'ios' && typeof(n.attr('itunesid')) != 'undefined' && n.attr('itunesid') != '' && n.attr('itunesid') != '0') n.click(downItunes);
else n.addClass('disable').click(downPage);
n.attr('r', '1').css('visibility', 'visible');
});
}

function initSize(){
var device = 'pc';
if(isAndroid()) device = 'android';
else if(isIOS()) device = 'ios';

var getSize = function(s){
if(s > 1048576) return (parseInt(s / 1048576 * 100) / 100) + 'GB';
else if (s > 1024) return (parseInt(s / 1024 * 100) / 100) + 'MB';
else return s + 'KB';
}
$('q[ios][android][r!=1]').each(function(i, n){
n = $(n);
if(device == 'android' && typeof(n.attr('android')) != 'undefined' && n.attr('android') != '') n.text(getSize(n.attr('android')));
else if(device == 'ios' && typeof(n.attr('ios')) != 'undefined' && n.attr('ios') != '') n.text(getSize(n.attr('ios')));
else if(device == 'ios' && typeof(n.attr('itunesid')) != 'undefined' && n.attr('itunesid') != '' && n.attr('itunesid') != '0') n.text(getSize(n.attr('ios')));
else n.text('-');
n.attr('r', '1');
});
}

function initUrl(){
$('*[url]').each(function(i, n){
n = $(n);
var url = n.attr('url');
n.click(function(){
window.open(url);
}).removeAttr('url');
});
}

function initHeader(){
var changeBar = function(name){
var trg = $('header .ct>.' + name);
var cur = $('header .ct>.cur');
if(trg.length == 0) return;
if(trg.is(cur)) {
trg.removeClass('cur');
return null;
}
else {
cur.removeClass('cur');
trg.addClass('cur');
return trg;
}
}
$('header .func .find').click(function(){
var obj = changeBar('search');
if(obj != null) obj.find('input').focus();
return false;
});
var height = $('header .fixed .ads:visible').height();
if(height > 0) {
height = $('header .fixed').height() + height;
$('header, header .fixed').css('height', height);
}
}

function initNav(cur){
if(typeof(cur) == 'undefined' || cur == '') return;
var nav = $('nav');
var ckn = 'DIYIAPP_VISIT';
var visit = JSON.parse(cookie(ckn));
if(visit == null) visit = {};
if(nav.hasClass('t2')){
nav = nav.find('ul');
var c = nav.find('li[rel=' + cur + ']');
var adjust = function(){
var left = c.offset().left;
var scroll = nav.scrollLeft();
if(left < 0) scroll += left;
else if(left > nav.width() - c.outerWidth(true)) scroll += left - (nav.width() - c.outerWidth(true) * 1.5);
nav.scrollLeft(scroll);
}
c.find('a').addClass('cur');
adjust();
win.bind('resize', adjust);
}

/*visit[cur] = Math.round(new Date().getTime() / 1000);

$.ajax({
'type': 'GET',
'dataType': 'jsonp',
'url': 'http://api.diyiapp.

Prev | Next
Pg.: 1 ... 17 18 19 20 21 22 23


Back to home | File page

Subscribe | Register | Login | N