(function () { window.addEventListener("tizenhwkey", function (ev) { var activePopup = null, page = null, pageId = ""; if (ev.keyName === "back") { activePopup = document.querySelector(".ui-popup-active"); page = document.getElementsByClassName("ui-page-active")[0]; pageId = page ? page.id : ""; if ((pageId === "page_main") && !activePopup) { try { tizen.application.getCurrentApplication().exit(); } catch (ignore) { } } else { window.history.back(); } } }); }()); __page_count = 0; function parseSitemap(sitemap, status) { parseWidgets(sitemap.homepage.widgets, $('#frame_main')); $('#page_main').addClass('ui-page-active'); $("body").append($('#page_main')); } function createSubFrame(wdg, parent) { var page_name = 'page_' + __page_count.toString(); var newframe = $('
') .addClass('ui-content') .prop('id', 'frame_' + __page_count.toString()); var parent_name = parent.parent().prop('id'); console.log(parent_name); var sub_name = ('label' in wdg)?wdg.label:wdg.title; var newpage = $('
') .addClass('ui-page') .prop('id', page_name) .append($('
') .append($('

') .text(sub_name) .click(function(){tau.changePage('#'+parent_name);}) ) ) .append(newframe); parent.append($('
') .text(sub_name) .click(function(){tau.changePage('#'+page_name,null,'#'+parent_name,true);})); $("body").append(newpage); __page_count += 1; return newframe; } function createSwitch(wdg, page) { if (wdg.mappings.length === 0) { page.append($('
').addClass('ui-switch') .append($('
').addClass('ui-switch-text').text(wdg.label)) .append($('