Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

load.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. window.fn = {};
  2. window.fn.toggleMenu = function () {
  3. document.getElementById('appSplitter').right.toggle();
  4. };
  5. window.fn.loadView = function (index) {
  6. document.getElementById('appTabbar').setActiveTab(index);
  7. document.getElementById('sidemenu').close();
  8. };
  9. window.fn.loadLink = function (url) {
  10. window.open(url, '_blank');
  11. };
  12. window.fn.pushPage = function (page, anim) {
  13. try {
  14. //Open and send json file that is equivalent with the especification.
  15. var request = new XMLHttpRequest();
  16. request.open("GET", "Server/" + page.title.toUpperCase() + ".json", false);
  17. request.send(null)
  18. //Replace with Christian's implementation...
  19. var artesanos = JSON.parse(request.responseText);
  20. }
  21. catch() {
  22. var artesanos = null;
  23. }
  24. if (anim) {
  25. document.getElementById('myNavigator').pushPage(page.id, { data: { title: page.title, esp: page.esp, json: artesanos } , animation: anim });
  26. } else {
  27. document.getElementById('myNavigator').pushPage(page.id, { data: { title: page.title, esp: page.esp, json: artesanos } });
  28. }
  29. };