UNPKG

htd-lync

Version:

This library is meant to be used to interact with an HTD Lync 12

166 lines (132 loc) 4.29 kB
document.addEventListener("deviceready", deviceReady, false); document.addEventListener("resume", appResumed, false); function appResumed() { console.log("app resumed"); //getID(); window.location.reload(true); } var device; function deviceReady() { console.log("deviceReady") var agent = navigator.userAgent; var isIPad = (agent.indexOf("iPad") > 0) || (agent.indexOf('macintosh') > 0); var isIPhone = (agent.indexOf("iPhone") > 0); if (isIPad) { device = "iPad"; //window.screen.orientation.lock('landscape'); } else if (isIPhone) { device = "iPhone" window.screen.orientation.lock('portrait'); } else if (window.innerWidth < 500 || window.innerHeight < 500) { console.log("lock android phone rotation"); window.screen.orientation.lock('portrait'); } window.addEventListener('orientationchange', function() { console.log("rotated:" + screen.orientation.type); // e.g. portrait window.location.reload(); }); console.log(window.innerWidth + ":" + window.innerHeight) //ipad pro 12.9 is 1366x1024 //ipad is 768x1024 //red android is 360x574 //iphone x is 375 x 667 //old tabled is 800 x 1207 loadTopShortcuts(); hidePages(); console.log("lastPage: " + lastPage) if (lastPage == "musicPlayer") { goToMusicPage(Gzone); } else if (lastPage == "groupControl") { goToGroupControlPage(systems[systemIdx].system.defaultGroup); } else if (lastPage == "presetControl") { goToPresetControlPage(0); } else { goToHomePage(); } var testDiv = document.getElementById("click1"); console.log("TOP:" + testDiv.offsetTop); var footerDiv = document.getElementById("footerDiv"); console.log("BOTTOM:" + footerDiv.offsetTop); console.log(window.innerHeight); } function checkStruckLoading() { if (stuckLoading) { console.log("stuck loading, reloading...") window.location.reload(true); } } $("#systemStatusText").on("click", function() { console.log("systemStatusText") window.location.reload(true); //getID(); }); if (systems[systemIdx].system.shortcutsEnabled == true) { $('#shortcutsEnabled').prop("checked", true) $('.music-item-wrapper').show(); } else { $('#shortcutsEnabled').prop("checked", false) $('.music-item-wrapper').hide(); } if (systems[systemIdx].system.settingsLocked == true) { $('#lockSettingsText').text("Lock Status"); $('#lockSettingsButton').text("Unlock"); } if (systems[systemIdx].system.shortcutsEnabled == false) { $('.topbar').addClass('toggle-height'); $('.music-item-wrapper').hide(); } else { $('.topbar').removeClass('toggle-height'); $('.music-item-wrapper').show(); } $(document).ready(function() { $('#gatewayID').text(systems[systemIdx].system.ip); $("#click1").click(function(e) { e.stopPropagation(); var container = $("#menu"); //check if the clicked area is dropDown or not if (container.has(e.target).length === 0) { $('.dropdown-content').removeClass("active"); } }) $("#click2").click(function(e) { e.stopPropagation(); var container = $("#menu"); //check if the clicked area is dropDown or not if (container.has(e.target).length === 0) { $('.dropdown-content').removeClass("active"); } }) $(document).click(function(e) { e.stopPropagation(); var container = $("#menu"); //check if the clicked area is dropDown or not if (container.has(e.target).length === 0) { $('.dropdown-content').removeClass("active"); } }) $('.close').click(function() { $(this).parents('.tabs-text').hide(); }); $('.add-btn').click(function() { $('.popup').show(); $('.popup').css("box-shadow", "0px 0px 0px 9999px rgba(0, 0, 0, 0.9)"); }); $('.opn-source').click(function() { $('.popup2').show(); $('.popup2').css("box-shadow", "0px 0px 0px 9999px rgba(0, 0, 0, 0.9)"); $('.menu-btn').hide(); }); $('#hidebox').click(function() { $('.popup').hide(); }); $('#hidebox2').click(function() { $('.popup2').hide(); }); }); var menuActive; $('.dropbtn').click(function() { $(this).parents('.dropdown').find('.dropdown-content').toggleClass("active"); }); $('.list-grid-right').click(function() { $(this).parents('.list-box').find('.list-grid').toggleClass("active"); });