Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Dom7
- var $$ = Dom7;
- // Framework7 App main instance
- var app = new Framework7({
- root: "#app", // App root element
- id: "io.framework7.testapp", // App bundle ID
- name: "Framework7", // App name
- theme: "auto", // Automatic theme detection
- // App root data
- data: function() {
- return {
- user: {
- firstName: "John",
- lastName: "Doe"
- },
- // Demo products for Catalog section
- products: [
- {
- id: "1",
- title:
- "ੴ ਸਤਿ ਨਾਮੁ ਕਰਤਾ ਪੁਰਖੁ ਨਿਰਭਉ ਨਿਰਵੈਰੁ ਅਕਾਲ ਮੂਰਤਿ ਅਜੂਨੀ ਸੈਭੰ ਗੁਰ ਪ੍ਰਸਾਦਿ ॥",
- description:
- "One Universal Creator God. The Name Is Truth. Creative Being Personified. No Fear. No Hatred. Image Of The Undying, Beyond Birth, Self-Existent. By Guru's Grace ~"
- },
- {
- id: "2",
- title: "॥ ਜਪੁ ॥",
- description: 'Name of the Composition, "Jup". Chant And Meditate:'
- },
- {
- id: "3",
- title: "ਆਦਿ ਸਚੁ ਜੁਗਾਦਿ ਸਚੁ ॥",
- description: "True In The Primal Beginning. True Throughout The Ages."
- },
- {
- id: "4",
- title: "ਹੈ ਭੀ ਸਚੁ ਨਾਨਕ ਹੋਸੀ ਭੀ ਸਚੁ ॥੧॥",
- description:
- "True Here And Now. O Nanak, Forever And Ever True. ||1||"
- },
- {
- id: "5",
- title: "ਸੋਚੈ ਸੋਚਿ ਨ ਹੋਵਈ ਜੇ ਸੋਚੀ ਲਖ ਵਾਰ ॥",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "6",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "7",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "8",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "9",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "10",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "11",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "12",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "13",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "14",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "15",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "16",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "17",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "18",
- title: "Apple iPhone 8 Plus",
- description: "Velit odit autem modi saepe ratione totam minus"
- },
- {
- id: "19",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- },
- {
- id: "20",
- title: "Apple iPhone X",
- description: "Expedita sequi perferendis quod illum pariatur aliquam"
- }
- ]
- };
- },
- // App root methods
- methods: {
- helloWorld: function() {
- app.dialog.alert("Hello World!");
- }
- },
- // App routes
- routes: routes
- });
- // Init/Create views
- var homeView = app.views.create("#view-home", {
- url: "/"
- });
- var catalogView = app.views.create("#view-catalog", {
- url: "/catalog/"
- });
- var settingsView = app.views.create("#view-settings", {
- url: "/settings/"
- });
- // Login Screen Demo
- $$("#my-login-screen .login-button").on("click", function() {
- var username = $$('#my-login-screen [name="username"]').val();
- var password = $$('#my-login-screen [name="password"]').val();
- // Close login screen
- app.loginScreen.close("#my-login-screen");
- // Alert username and password
- app.dialog.alert("Username: " + username + "<br>Password: " + password);
- });
- // Virtual list
- var test = [];
- var items = [];
- app.request.json("js/shabads.json", function(data) {
- console.log(data);
- for (itm in data) {
- // console.log(data[itm].id);
- test.push(data[itm]);
- }
- for (var iD = 0; iD <= 9; iD++) {
- // console.log(iD);
- items.push({
- title: data.gurbani[iD].shabad.gurbani.unicode,
- subtitle: data.gurbani[iD].shabad.translation.english.ssk
- });
- console.log(items);
- }
- virtualList = app.virtualList.create({
- // List Element
- el: ".virtual-list",
- // Pass array with items
- items: items,
- // Custom search function for searchbar
- searchAll: function(query, items) {
- var found = [];
- for (var i = 0; i < items.length; i++) {
- if (
- items[i].title.toLowerCase().indexOf(query.toLowerCase()) >= 0 ||
- query.trim() === ""
- )
- found.push(i);
- }
- return found; //return array with matched indexes
- },
- // List item Template7 template
- itemTemplate:
- "<li>" +
- '<a href="#" class="item-link item-content">' +
- '<div class="item-inner">' +
- '<div class="item-title-row">' +
- '<div class="item-title">{{gurbani}}</div>' +
- "</div>" +
- '<div class="item-subtitle">{{translation}}</div>' +
- "</div>" +
- "</a>" +
- "</li>",
- // Item height
- height: app.theme === "ios" ? 63 : 73
- });
- });
- // console.log(items);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement