var apiPane = null;//开放API对象 var pageItems = [];//菜单集合 $(document).ready(function(){ langInitByUrl(); apiPane = new apiPage(); loadReadyPage(); }); function loadReadyPage() { if (typeof lang == "undefined") { setTimeout(loadReadyPage, 50); } else { //加载语言 loadLang(); //获取服务器平台信息 ajaxLoadInformation(); initApiPageItems(); loadPage(); } } //加载语言 function loadLang() { $('#spanHome').text(lang.open_home); $('#spanWeb').text(lang.open_webApi); $('#spanPhone').text(lang.open_phoneApi); $('#spanWindows').text(lang.open_windowsApi); $('#H1Title').text(lang.open_phoneApiFile); $('#spanApiDesc').text(lang.open_phoneApiDesc); document.title = lang.open_phoneApiFile; } //加载页面 function loadPage() { if(!pageItems) { setTimeout(loadPage, 50); }else { loadMainPane(); } } //加载主页面 function loadMainPane() { var leftContent = '
"; $("#mainPane").append(leftContent + rightContent); //加载bootstrap js addBootstrapJs(); $(".nav-header.menu-first").on('click',function(){ var newIndex = $(this).index(); if(newIndex && oldIndex != newIndex){ //关闭以及打开的栏目 其他走框架 $(".nav.nav-list.in.collapse").each(function(){ $(this).removeAttr("style"); $(this).attr("class","nav nav-list collapse"); }); oldIndex = newIndex; } }); } var oldIndex = 0; //加载bootstrap js function addBootstrapJs() { loadScript('../../bootstrap/js/bootstrap-v2.3.2.min.js', function() { //菜单添加滑动点击事件 $('[data-spy="scroll"]').each(function () { $(this).scrollspy(); }); loadScript('../../bootstrap/js/holder.min.js', null); loadScript('../../bootstrap/js/application.js', null); }); } //初始化页面菜单数组 function initApiPageItems() { //android api var android = initPriviInfo(6, "android-operate"); android.privis = []; android.privis.push(initPriviInfo(61, "android-login"));//登陆 pageItems.push(android); // ios api var ios = initPriviInfo(7, "ios-operate"); ios.privis = []; ios.privis.push(initPriviInfo(71, "ios-login"));//登陆 pageItems.push(ios); } //获取数组 function initPriviInfo(id, name) { return {id: id, name : name}; } //获取服务器平台信息 function ajaxLoadInformation() { //向服务器发送ajax请求 $.ajax({ url: 'StandardLoginAction_information.action', type:"post", data: null, cache:false,/*禁用浏览器缓存*/ dataType:"json", success:function(json){ if(json.result == 0){ document.title = lang.open_phoneApiFile; if (langIsChinese()) { if (json.ChineseMainTitle != null) { document.title += '-'+ json.ChineseMainTitle; $('#spanTitle').text(json.ChineseMainTitle); } if (json.ChineseCopyright != null) { $("#spanCopyright").html(json.ChineseCopyright); } } /*else if (langIsTW()){ if (json.TwMainTitle != null) { document.title += '-'+ json.TwMainTitle; $('#spanTitle').text(json.TwMainTitle); } if (json.TwCopyright != null) { $("#spanCopyright").html(json.TwCopyright); } }*/ else { if (json.EnglishMainTitle != null) { document.title += '-'+ json.EnglishMainTitle; $('#spanTitle').text(json.EnglishMainTitle); } if (json.EnglishCopyright != null) { $("#spanCopyright").html(json.EnglishCopyright); } } } else { alert(lang.errException); } },error:function(XMLHttpRequest, textStatus, errorThrown){ if (textStatus != "error") { //alert(parent.lang.errSendRequired + " errorThrown:" + errorThrown + ",textStatus:" + textStatus); } alert(lang.errException); } }); }