Create app template

master
Skylar Ittner 4 years ago
commit 0a1fe2c149

@ -0,0 +1,6 @@
[Dolphin]
Timestamp=2020,6,4,19,49,6
Version=4
[Settings]
HiddenFilesShown=true

7
.gitignore vendored

@ -0,0 +1,7 @@
node_modules/
www/node_modules/
platforms
nbproject/private
plugins
*yarn-error.log
*npm-debug.log

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="com.netsyms.template" version="1.0.0">
<name>Lecte</name>
<description>
App Template
</description>
<author email="dev@netsyms.com" href="https://netsyms.com">
Netsyms Technologies
</author>
<content src="index.html"/>
<plugin name="cordova-plugin-whitelist" spec="1"/>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<access launch-external="yes" origin="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="HeaderColor" value="#4CAF50" />
<!--
<resource-file src="/res/android/drawable/ic_launcher_background.xml" target="/app/src/main/res/drawable/ic_launcher_background.xml" />
<resource-file src="/res/android/drawable/ic_launcher_foreground.xml" target="/app/src/main/res/drawable/ic_launcher_foreground.xml" />
<resource-file src="res/android/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="mdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-mdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="hdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-hdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xhdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xxhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xxhdpi/ic_launcher.png" />
<icon background="res/android/drawable/ic_launcher_background.xml" density="xxxhdpi" foreground="res/android/drawable/ic_launcher_foreground.xml" src="res/android/mipmap-xxxhdpi/ic_launcher.png" />
-->
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<hook src="scripts/npm_prepare.sh" type="before_prepare" />
</widget>

@ -0,0 +1,23 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Generated file; DO NOT EDIT.
-->
<project name="CommunityVotingApp" basedir="..">
<property file="nbproject/configs/${config}.properties" />
<scriptdef name="checkVersion" language="javascript">
<attribute name="first" />
<attribute name="property" />
<![CDATA[
var first = attributes.get("first");
if (first >= "3.0.0") {
project.setProperty(attributes.get("property"), true);
}
]]>
</scriptdef>
<scriptdef name="forDevice" language="javascript">
<![CDATA[
var dev = project.getProperty("device");
if (dev == "device") {
project.setProperty("build.for.device", true);
}
]]>
</scriptdef>
<target name="check-cordova-project">
<condition property="cordova.project">
<or>
<available file=".cordova"/>
<available file="hooks"/>
</or>
</condition>
</target>
<target name="upgrade-to-cordova-project" depends="check-cordova-project,check-cordova-version" unless="cordova.project">
<echo level="info" message="${cordova.command} -d create ${java.io.tmpdir}/nb_temp_project com.coolappz.${project.name} ${project.name}" />
<delete dir="${java.io.tmpdir}/nb_temp_project"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true" >
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="create"/>
<arg value="${java.io.tmpdir}/nb_temp_project"/>
<arg value="com.coolappz.${project.name}"/>
<arg value="${project.name}" />
</exec>
<copy todir="." overwrite="true" failonerror="false">
<fileset dir="${java.io.tmpdir}/nb_temp_project"/>
</copy>
<delete dir="${java.io.tmpdir}/nb_temp_project"/>
<delete dir="www"/>
<copy todir="www" failonerror="false" quiet="true" >
<fileset dir="${site.root}"/>
</copy>
</target>
<target name="create-hello-world" depends="check-cordova-version">
<echo level="info" message="${cordova.command} -d create www_nb_temp com.coolappz.${project.name} ${project.name}" />
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="create"/>
<arg value="www_nb_temp"/>
<arg value="com.coolappz.${project.name}"/>
<arg value="${project.name}" />
</exec>
<delete dir="www"/>
<mkdir dir="www"/>
<move file="www_nb_temp/www" tofile="www"/>
<delete dir="www_nb_temp"/>
<delete file="www/config.xml"/>
</target>
<taskdef
classname="org.netbeans.modules.cordova.updatetask.ReadConfigTask"
classpath="${update.task.jar}"
name="readconfig"/>
<taskdef
classname="org.netbeans.modules.cordova.updatetask.PluginTask"
classpath="${update.task.jar}"
name="plugintask"/>
<target name="check-cordova-version">
<property environment="env"/>
<checkVersion first="${cordova.version}" property="cordova.ver.3"/>
<fail message="Cordova version 3 or greater required." unless="cordova.ver.3"/>
<readconfig/>
<forDevice/>
</target>
<target name="check-android-template">
<available file="platforms/android" property="android.generated.exists"/>
</target>
<target name="check-ios-template">
<available file="platforms/ios" property="ios.generated.exists"/>
</target>
<target name="create-android" depends="check-android-template,check-cordova-version,upgrade-to-cordova-project" unless="android.generated.exists">
<echo level="info" message="${cordova.command} -d platform add android"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="platform"/>
<arg value="add"/>
<arg value="android"/>
</exec>
</target>
<target name="create-ios" depends="check-ios-template,check-cordova-version,upgrade-to-cordova-project" unless="ios.generated.exists">
<echo level="info" message="${cordova.command} -d platform add ios"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" dir="." failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="platform"/>
<arg value="add"/>
<arg value="ios"/>
</exec>
</target>
<target name="rebuild-ios" depends="clean-ios,build-ios"/>
<target name="build-ios" depends="create-ios,update-plugins,update-ios,build-ios-xcodebuild,build-ios-ipa"/>
<target name="build-ios-xcodebuild">
<property name="path" location="platforms/ios/build"/>
<exec executable="xcodebuild" dir="platforms/ios" failonerror="true">
<arg value="-project"/>
<arg value="${project.name}.xcodeproj"/>
<arg value="ARCHS=${ios.build.arch}"/>
<arg value="-target"/>
<arg value="${project.name}"/>
<arg value="-configuration"/>
<arg value="Release"/>
<arg value="-sdk"/>
<arg value="${ios.build.sdk}" />
<arg value="build"/>
<arg value="CONFIGURATION_BUILD_DIR=${path}"/>
</exec>
</target>
<target name="build-ios-ipa" if="build.for.device">
<exec executable="xcrun" dir="platforms/ios/build" failonerror="true">
<env key="CODESIGN_ALLOCATE" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" />
<arg value="-sdk"/>
<arg value="${ios.build.sdk}" />
<arg value="PackageApplication"/>
<arg value="-v"/>
<arg value="${project.name}.app"/>
<arg value="-o"/>
<arg value="${basedir}/platforms/ios/build/${project.name}.ipa"/>
<arg value="--sign"/>
<arg value="${ios.certificate.name}"/>
<arg value="--embed"/>
<arg value="${ios.provisioning.profile}"/>
</exec>
<available file="${basedir}/platforms/ios/build/${project.name}.ipa" property="ipa.found"/>
<fail unless="ipa.found" message="PackageApplication failed."/>
</target>
<target name="sim-ios" depends="build-ios,ios-run-device,ios-run-simulator">
</target>
<target name="ios-run-device" if="build.for.device">
<echo>
Install "${basedir}/platforms/ios/build/${project.name}.ipa" through iTunes and run it.
</echo>
<exec executable="open" failonerror="true">
<arg value="${basedir}/platforms/ios/build/${project.name}.ipa"/>
</exec>
</target>
<target name="ios-run-simulator" unless="build.for.device">
<exec executable="killall" dir="platforms/ios/build">
<arg value="launchd_sim"/>
</exec>
<exec executable="${ios.sim.exec}" dir="platforms/ios/build">
<arg line="launch ${project.name}.app ${ios.device.args} --exit"/>
</exec>
</target>
<target name="update-plugins">
<plugintask/>
</target>
<target name="update-android">
<echo level="info" message="${cordova.command} prepare android"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="prepare"/>
<arg value="android"/>
</exec>
</target>
<target name="update-ios">
<echo level="info" message="${cordova.command} prepare ios"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="prepare"/>
<arg value="ios"/>
</exec>
</target>
<target name="rebuild-android" depends="clean-android,build-android"/>
<target name="build-android" depends="create-android,update-plugins">
<echo level="info" message="${cordova.command} -d build android"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="build"/>
<arg value="android"/>
</exec>
</target>
<target name="sim-android" depends="create-android,update-plugins">
<echo level="info" message="${cordova.command} -d ${android.target.device.arg} android"/>
<exec executable="${cordova.command}" resolveexecutable="true" searchpath="true" failonerror="true">
<env key="${cordova.path.key}" path="${cordova.path.value}:${android.sdk.home}/tools:${android.sdk.home}/platform-tools:${jdk.home}/bin:${ant.home}/bin:${jdk.home}/bin"/>
<env key="JAVA_HOME" path="${jdk.home}"/>
<arg value="-d"/>
<arg value="${android.target.device.arg}"/>
<arg value="android"/>
</exec>
</target>
<target name="clean-android" depends="check-android-template" if="android.generated.exists">
<exec executable="./gradlew" dir="platforms/android">
<arg value="clean" />
</exec>
</target>
<target name="clean-ios" depends="check-ios-template" if="ios.generated.exists">
<exec executable="platforms/ios/cordova/clean" />
</target>
</project>

@ -0,0 +1,3 @@
device=emulator
display.name=Android Emulator
type=android

@ -0,0 +1,3 @@
device=device
display.name=Android Device
type=android

@ -0,0 +1,5 @@
device=emulator
display.name=iPhone Simulator
ios.build.arch=i386
ios.build.sdk=
type=ios

@ -0,0 +1,5 @@
device=device
display.name=iPhone Device
ios.build.arch=armv7 armv7s
ios.build.sdk=
type=ios

@ -0,0 +1,48 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# This is a list of plugins installed in your project
# You can delete or add new plugins
#
# Format is following:
# id.of.plugin=url_of_repository
#
# Corresponding "id.of.plugin" can be found in the plugin's plugin.xml file:
# <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="foo.bar.plugin" version="0.0.1">
#
# This list contains all core cordova plugins.
#
# For more information about plugins see http://cordova.apache.org/blog/releases/2013/07/23/cordova-3.html
#
cordova-plugin-device=https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
cordova-plugin-network-information=https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
cordova-plugin-battery-status=https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git
cordova-plugin-device-motion=https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion.git
cordova-plugin-device-orientation=https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation.git
cordova-plugin-geolocation=https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
cordova-plugin-camera=https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
cordova-plugin-media-capture=https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
cordova-plugin-media=https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
cordova-plugin-file=https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
cordova-plugin-file-transfer=https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
cordova-plugin-dialogs=https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
cordova-plugin-vibration=https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git
cordova-plugin-contacts=https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts.git
cordova-plugin-globalization=https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git
cordova-plugin-splashscreen=https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
cordova-plugin-console=https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git

@ -0,0 +1,22 @@
auxiliary.org-netbeans-modules-cordova.cordova_5f_build_5f_script_5f_version=52
auxiliary.org-netbeans-modules-cordova.phonegap=true
auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
auxiliary.org-netbeans-modules-javascript-nodejs.run_2e_enabled=false
auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs
browser.autorefresh.Chrome.INTEGRATED=true
browser.highlightselection.Chrome.INTEGRATED=true
browser.run=true
file.reference.CordovaAppTemplate-test=test
file.reference.CordovaAppTemplate-www=www
file.reference.NetsymsCordovaTemplate-www=www
files.encoding=UTF-8
project.license=mpl
site.root.folder=${file.reference.NetsymsCordovaTemplate-www}
start.file=index.html
web.context.root=/NetsymsCordovaTemplate

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>Mobile App Template</name>
</data>
<libraries xmlns="http://www.netbeans.org/ns/cdnjs-libraries/1"/>
</configuration>
</project>

@ -0,0 +1,34 @@
{
"name": "com.netsyms.template",
"displayName": "App Template",
"version": "1.0.0",
"description": "",
"main": "www/index.html",
"window": {
"icon": "res/logo.png",
"id": "com.netsyms.template.template_window_main_00001",
"frame": true
},
"user_agent": "Mozilla/5.0 (%osinfo) %name/%ver NW.js/%nwver WebKit/%webkit_ver Chromium/%chromium_ver",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ecosystem:cordova"
],
"author": "Netsyms Technologies",
"license": "MPL-2.0",
"dependencies": {
"cordova-android": "^8.1.0"
},
"cordova": {
"plugins": {
"cordova-plugin-geolocation": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-headercolor": {}
}
}
}

@ -0,0 +1,15 @@
#!/bin/bash
# Copyright 2020 Netsyms Technologies.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
echo "Generating credits files..."
cd www
yarn licenses generate-disclaimer > ../license-credits.md
cd ..
yarn licenses generate-disclaimer >> license-credits.md
cp www/pages/credits.template.html www/pages/credits.html
sed -e "/{{credits}}/r license-credits.md" -e "/{{credits}}/d" -i www/pages/credits.html

@ -0,0 +1,9 @@
#!/bin/sh
# Copyright 2020 Netsyms Technologies.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
./scripts/www_npm_install.sh
./scripts/generate_credits.sh
./scripts/remove_bloat.sh

@ -0,0 +1,88 @@
#!/bin/bash
# Copyright 2020 Netsyms Technologies.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This script removes some stuff in `www/node_modules` that the app doesn't need to run.
# It removes about 6MB from the build size.
echo "Removing bloat in node_modules..."
# exit when any command fails
# this script nuked my home folder once, hopefully it won't happen again now.
set -e
DIR="$(pwd)/www/node_modules"
cd $DIR
rm -rf buffer-from
rm -rf concat-stream
rm -rf csscolorparser
rm -rf dom7
rm -rf earcut
rm -rf geojson-vt
rm -rf gl-matrix
rm -rf grid-index
rm -rf ieee754
rm -rf inherits
rm -rf kdbush
rm -rf list
rm -rf @mapbox
rm -rf minimist
rm -rf murmurhash-js
rm -rf path-to-regexp
rm -rf pbf
rm -rf potpack
rm -rf protocol-buffers-schema
rm -rf quickselect
rm -rf readable-stream
rm -rf resolve-protobuf-schema
rm -rf rw
rm -rf safe-buffer
rm -rf ssr-window
rm -rf string_decoder
rm -rf supercluster
rm -rf template7
rm -rf tinyqueue
rm -rf typedarray
rm -rf util-deprecate
rm -rf vt-pbf
# Make npm stop complaining that these don't exist by actually removing them
rm -rf .bin/*
cd @fortawesome/fontawesome-pro
rm -rf {js,less,metadata,scss,sprites,svgs}
find css -type f -not -name 'all.min.css' -delete
cd $DIR
cd framework7
rm -rf components
rm -rf lazy-components
rm -rf less
rm -rf modules
rm -rf utils
rm -f framework7.*
rm -f framework7-lite.*
find css -type f -not -name 'framework7.bundle.min.css' -delete
find js -type f -not -name 'framework7.bundle.min.js' -delete
cd $DIR
cd framework7-icons
rm -rf svg
cd $DIR
cd jquery
rm -rf src
rm -rf external
find dist -type f -not -name 'jquery.min.js' -delete
cd $DIR
cd material-design-icons
# Remove everything except the icon font and license, but also exclude the
# current and parent folder (. , ..) so rm won't complain about refusing
# to delete the whole filesystem
find . -maxdepth 1 -not -name '.' -not -name 'LICENSE' -not -name 'iconfont' -exec rm -rf {} \;
cd $DIR
echo "Cleanup finished"

@ -0,0 +1,11 @@
#!/bin/bash
# Copyright 2020 Netsyms Technologies.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
echo "Installing node modules in www/..."
cd www
npm install --no-bin-links --production
cd ..

@ -0,0 +1,74 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
Framework7 and FontAwesome both have a .fab class
*/
.fafab {
font-family: "Font Awesome 5 Brands";
}
.fab {
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
font-family: var(--f7-font-family);
font-size: var(--f7-font-size);
line-height: var(--f7-line-height);
}
.page-content-fab-pad {
padding-bottom: var(--f7-fab-size);
}
.navbar, .item-link .item-title, .item-media, .item-divider, .item-label, .fab, .button, .noselect {
user-select: none;
}
.navbar-inner {
-webkit-app-region: drag;
}
.navbar-inner > * {
-webkit-app-region: no-drag;
}
/*
* Material icons are too big and disrupt the flow of text
*/
.block .material-icons {
font-size: var(--f7-block-font-size);
}
.material-icons.material-icons-24px {
font-size: 24px;
}
.material-icons-intext .material-icons {
font-size: var(--f7-block-font-size);
}
.no-animation * {
-webkit-transition: 10ms !important;
-moz-transition: 10ms !important;
-o-transition: 10ms !important;
-ms-transition: 10ms !important;
transition: 10ms !important;
}
/*
Allow easily changing help text to reflect finger/mouse usage.
*/
.clicktext {
display: none;
}
@media (pointer:fine) {
.taptext {
display: none;
}
.clicktext {
display: initial;
}
}

@ -0,0 +1,17 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
We want the backdrops to be there so there aren't accidental touches,
but we don't want them to obscure anything.
*/
.actions-backdrop.backdrop-in, .custom-modal-backdrop.backdrop-in,
.dialog-backdrop.backdrop-in, .popover-backdrop.backdrop-in,
.popup-backdrop.backdrop-in, .preloader-backdrop.backdrop-in,
.sheet-backdrop.backdrop-in {
opacity: 0;
}

@ -0,0 +1,17 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Color adjustments for better OLED performance
*/
:root #app.theme-dark {
--f7-page-bg-color: #020202;
--f7-list-bg-color: #020202;
--f7-popover-bg-color: #020202;
--f7-sheet-bg-color: #020202;
}

@ -0,0 +1,81 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
Created on : Apr 3, 2020, 11:55:50 AM
Author : Skylar Ittner
*/
.only-tablet {
display: none;
}
@media all and (min-width: 768px) {
.only-tablet {
display: inherit;
}
.no-tablet {
display: none;
}
/*
.page.tabbed .tabbar {
Remove tab switcher at bottom of page
display: none;
height: 0;
}
.page.tabbed .tabs {
Put tabs next to each other
display: flex;
}
.page.tabbed .tabs .tab {
un-hide "non-active" tabs
display: block;
Make FABs stay where they should
position: relative;
}
.page.tabbed .tabs .tab.tab-67 {
width: 66.67% !important;
}
.page.tabbed .tabs .tab.tab-33 {
width: 33.33% !important;
}
.page.tabbed .page-content {
padding-top: 0;
padding-bottom: 0;
}*/
.elevation-tablet {
/* .elevation-3 */
box-shadow: var(--f7-elevation-3)!important;
}
/*
.page.tabbed .tabs .tab:not(:first-child) {
box-shadow: inset 5px 0 9px -5px rgba(0,0,0,0.3);
border-left: 1px solid rgba(0,0,0,0.1);
}*/
/*
.page.tabbed .fab {
margin-bottom: 0;
}
.sheet-backdrop.backdrop-in {
visibility: hidden;
}*/
.padding-bottom-tablet {
padding-bottom: 3rem !important;
}
/*
#mapbox {
height: calc(100% - var(--f7-navbar-height));
}*/
}
@media all and (min-width: 768px) and (min-height: 700px) {
.margin-top-tablet {
margin-top: 1rem;
}
}

@ -0,0 +1,43 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#web-barcode-ui {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
display: block;
background: rgba(0,0,0,0.75);
}
#web-barcode-ui.hidden {
display: none;
}
#web-barcode-ui video#barcode-viewer {
max-width: calc(100% - 2em);
max-height: calc(100% - 2em);
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 1em;
}
#web-barcode-ui .text {
position: absolute;
left: 0;
bottom: 0;
width: 100vw;
padding: 1em 5px 1em 5px;
color: white;
text-align: center;
background: rgba(0,0,0,0.5);
}

@ -0,0 +1,60 @@
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src:
local('Roboto'),
local('Roboto-Regular'),
url('Roboto_400.woff') format('woff'),
url('Roboto_400.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src:
local('Roboto Italic'),
local('Roboto-Italic'),
url('Roboto_400i.woff') format('woff'),
url('Roboto_400i.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src:
local('Roboto Medium'),
local('Roboto-Medium'),
url('Roboto_500.woff') format('woff'),
url('Roboto_500.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 500;
src:
local('Roboto Medium Italic'),
local('Roboto-MediumItalic'),
url('Roboto_500i.woff') format('woff'),
url('Roboto_500i.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src:
local('Roboto Bold'),
local('Roboto-Bold'),
url('Roboto_700.woff') format('woff'),
url('Roboto_700.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 700;
src:
local('Roboto Bold Italic'),
local('Roboto-BoldItalic'),
url('Roboto_700i.woff') format('woff'),
url('Roboto_700i.woff2') format('woff2');
}

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html>
<head>
<title>Loading</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
*,html,body {
background-color: #fff;
font-family: Roboto, Ubuntu, sans-serif;
text-align: center;
}
div {
margin-top: 1rem;
}
</style>
</head>
<body>
<div>Loading...</div>
<script src="../settings.js"></script>
<script>
window.location.href = SETTINGS.loginurl;
</script>
</body>
</html>

@ -0,0 +1,38 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
$(window).on("message", function (e) {
var data = e.originalEvent.data;
var parts = data.split("&");
var u = "";
var p = "";
for (var i = 0; i < parts.length; i++) {
if (parts[i].startsWith("user:")) {
u = parts[i].replace("user:", "");
} else if (parts[i].startsWith("password:")) {
p = parts[i].replace("password:", "");
}
}
if (u != "" && p != "") {
setStorage("username", u);
setStorage("password", p);
// Reset last change so we won't overwrite server settings
setStorage("lastchange", 0, true);
app.toast.show({
text: "You are now logged in!",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 3
});
restartApplication();
} else {
app.dialog.alert("There was a problem. Try again later.", "Error");
}
});

@ -0,0 +1,171 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var $$ = Dom7;
// Detect platform and run platform-specific setup code
// for Cordova, NW.js, or the browser
initPlatform();
var app = new Framework7({
root: "#app",
name: "TemplateApp",
id: "com.netsyms.template",
theme: platform_theme,
card: {
swipeToClose: false
},
popup: {
backdrop: true
},
popover: {
backdrop: true
},
init: true,
initOnDeviceReady: false,
routes: routes
});
var mainView = app.views.create('.view-main', {
url: "/",
animate: true
});
var router = mainView.router;
function restartApplication() {
window.location = "index.html";
}
router.on("pageInit", function (pagedata) {
pagedata.$el.find('script').each(function (el) {
if ($$(this).attr('src')) {
var s = document.createElement('script');
s.src = $$(this).attr('src');
$$('head').append(s);
} else {
eval($$(this).text());
}
});
// Stop text selection from popping a system toolbar even after changing pages
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection) {
document.selection.empty();
}
});
/**
* Perform back button behavior.
* Call this function whenever the equivalent to the Android back button is pressed.
* @returns {undefined}
*/
function handleBackButton() {
// Close map sheet if it's open
if ($(".sheet-modal").hasClass("modal-in")) {
app.sheet.close();
} else if ($(".searchbar-enabled")[0]) {
app.searchbar.disable();
} else if (scanningBarcode) {
return;
} else {
router.back({force: true, ignoreCache: true});
}
// Stop text selection from popping a system toolbar even after changing pages
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection) {
document.selection.empty();
}
}
$(document).keyup(function (e) {
if (e.key === "Escape" || e.keyCode == 27) {
handleBackButton();
}
});
$(document).mouseup(function (e) {
if (e.button == 3) {
handleBackButton();
}
});
router.on("routeChange", function (newRoute) {
console.log("Info", "Navigating to ", newRoute.path);
});
function setAppTheme(theme) {
if (theme == "light") {
$("#app").removeClass("theme-dark");
if (platform_type == "cordova" && cordova.platformId == 'android' && typeof StatusBar !== 'undefined') {
StatusBar.styleDefault();
StatusBar.backgroundColorByHexString("#E0E0E0");
}
} else if (theme == "dark") {
$("#app").addClass("theme-dark");
if (platform_type == "cordova" && cordova.platformId == 'android' && typeof StatusBar !== 'undefined') {
StatusBar.styleLightContent();
StatusBar.backgroundColorByHexString("#000000");
}
}
}
function applyColorTheme() {
if (getStorage("apptheme") == "dark") {
setAppTheme("dark");
} else if (getStorage("apptheme") == "light") {
setAppTheme("light");
} else {
// automatic theme, default light
if (typeof Framework7.device.prefersColorScheme() !== 'undefined' && Framework7.device.prefersColorScheme() == "dark") {
setAppTheme("dark");
} else {
setAppTheme("light");
}
}
}
/**
* Turn animations on or off.
* @param {boolean} on true for on, false for off.
* @returns {undefined}
*/
function toggleAnimations(on) {
if (on) {
$("#app").removeClass("no-animation");
} else {
$("#app").addClass("no-animation");
}
mainView.params.animate = on;
}
/**
* Turn animations on or off while considering user preferences.
* @param boolean enabled true to enable, false to disable, undefined to use animation=on/off setting.
* @returns {undefined}
*/
function setAnimations(enabled) {
if (getStorage("animation") == null) {
setStorage("animation", "auto");
}
if (typeof enabled !== "undefined") {
toggleAnimations(enabled == true);
return;
}
if (getStorage("animation") == "off") {
toggleAnimations(false);
} else if (getStorage("animation") == "on") {
toggleAnimations(true);
}
}
applyColorTheme();
setAnimations();
router.navigate("/");

@ -0,0 +1,187 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var platform_type = "";
var platform_theme = "md";
var app_version = "unknown";
var nw_tray = null;
/**
* If true and animations are set to "auto", animations should be disabled.
* @type Boolean
*/
var auto_disable_animations = false;
var openBrowser = function (url) {
window.open(url);
}
var openSystemBrowser = function (url) {
window.open(url);
}
var scanningBarcode = false;
var getLocation = function (success, error) {
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function (position) {
success(position);
}, function (err) {
if (typeof error == "function") {
error(err.message);
}
}, {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
});
} else {
if (typeof error == "function") {
error("Location is unavailable.");
}
}
}
var watchLocation = function (success, error) {
if ("geolocation" in navigator) {
navigator.geolocation.watchPosition(function (position) {
success(position);
}, function (err) {
if (typeof error == "function") {
error(err.message);
}
}, {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
});
} else {
if (typeof error == "function") {
error("Location is unavailable.");
}
}
}
function getPlatformTheme() {
return "aurora";
if (Framework7.device.ios) {
return "ios";
} else if (Framework7.device.macos) {
// Apple is trending towards one OS for all their crap,
// let's be ahead of that curve
return "ios";
} else if (Framework7.device.nwjs) {
return "md";
} else if (Framework7.device.android) {
return "md";
} else if (Framework7.device.desktop) {
return "aurora";
}
return "md";
}
function initCordova() {
platform_type = "cordova";
// Handle back button to close things
document.addEventListener("backbutton", handleBackButton, false);
document.addEventListener("deviceready", function () {
// Make sure the status bar color is set properly
applyColorTheme();
}, false);
openBrowser = function (url) {
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
}
openExternalBrowser = function (url) {
window.open(url, '_system', '');
}
// Handle geo: urls
$("#app").on("click", ".geolink", function (evt) {
window.open($(this).attr("href"), "_system");
evt.preventDefault();
});
}
function initNW() {
platform_type = "nw";
openBrowser = function (url) {
nw.Window.open(url, {
id: url
}, function (browserwin) {
// Add menubar so the user can navigate around if they click a link
var browsermenu = new nw.Menu({type: 'menubar'});
browsermenu.append(new nw.MenuItem({
label: "Back",
click: function () {
browserwin.window.history.back();
}
}));
browsermenu.append(new nw.MenuItem({
label: "Forward",
click: function () {
browserwin.window.history.forward();
}
}));
browsermenu.append(new nw.MenuItem({
label: "Home",
click: function () {
browserwin.window.location.href = url;
}
}));
browserwin.menu = browsermenu;
});
}
openExternalBrowser = function (url) {
require('nw.gui').Shell.openExternal(url);
}
// Handle geo: urls
$("#app").on("click", ".geolink", function (evt) {
require('nw.gui').Shell.openExternal($(this).attr("href"));
evt.preventDefault();
});
}
function initBrowser() {
platform_type = "browser";
openBrowser = function (url) {
window.open(url);
}
openExternalBrowser = function (url) {
window.open(url);
}
$("#app").on("click", ".geolink", function (evt) {
window.open($(this).attr("href"), "_blank");
evt.preventDefault();
});
}
function initPlatform() {
if (typeof cordova !== 'undefined') {
initCordova();
} else if (typeof nw !== 'undefined') {
initNW();
} else {
initBrowser();
}
platform_theme = getPlatformTheme();
$.getJSON("package.json", function (data) {
app_version = data.version;
});
}

@ -0,0 +1,77 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function logout() {
app.dialog.confirm(
"Are you sure you want to log out?",
"Log out?",
function () {
localStorage.removeItem('password');
localStorage.removeItem('username');
localStorage.removeItem('lastsync');
restartApplication();
}
);
}
function resyncAndRestart() {
app.toast.show({
text: "Syncing settings and restarting...",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
syncNow(function () {
restartApplication();
});
}
function clearCaches() {
app.toast.show({
text: "Clearing caches. You may need to restart the app to see a difference.",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
setStorage("geocode_cache", "{}");
if ('caches' in window) {
clearAllCaches();
}
}
$('.item-link[data-setting=apptheme] select').on("change", function () {
setStorage("apptheme", $('.item-link[data-setting=apptheme] select').val());
applyColorTheme();
});
$('.item-link[data-setting=animation] select').on("change", function () {
setStorage("animation", $('.item-link[data-setting=animation] select').val());
if (getStorage("animation") != "auto") {
setAnimations();
}
if (getStorage("animation") == "auto") {
toggleAnimations(auto_disable_animations == false);
}
});
$('.item-content[data-setting=wakelock] .toggle input').on("change", function () {
var checked = $(this).prop('checked');
setStorage("wakelock", checked);
if (platform_type == "cordova") {
loadSettings();
} else {
app.toast.show({
text: "This setting won't do anything on your device.",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
}
});

@ -0,0 +1,58 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Save something to persistent storage.
* @param {string} key
* @param {string} value non-string values are converted to strings.
* @param {bool} nochangeupdate If true, the lastchange setting won't be updated.
* @returns {undefined}
*/
function setStorage(key, value, nochangeupdate) {
if (typeof nochangeupdate == 'undefined') {
nochangeupdate = false;
}
localStorage.setItem(key, value);
if (!nochangeupdate && !SETTINGS.synckeyblacklist.includes(key)) {
localStorage.setItem("lastchange", Date.now() / 1000);
}
}
/**
* Get an item from persistent storage.
* @param {type} key
* @returns {DOMString}
*/
function getStorage(key) {
return localStorage.getItem(key);
}
/**
* Check if an item is in the persistent storage.
* @param {string} key
* @returns {Boolean}
*/
function inStorage(key) {
return localStorage.getItem(key) != null;
}
/**
* Get all item from persistent storage.
* @returns {Array} [{key: "", value: ""},...]
*/
function getAllStorage() {
var all = [];
for (var key in localStorage) {
if (localStorage.hasOwnProperty(key)) {
all.push({
key: key,
value: getStorage(key)
});
}
}
return all;
}

@ -0,0 +1,314 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Generate a UUID.
* From https://stackoverflow.com/a/2117523
* @returns {String}
*/
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
/**
* Perform a request against the API server. A simple wrapper around $.ajax().
*
* If username and password are strings, they will be used to authenticate.
*
* @param {string} action Request action
* @param {array} data AJAX data to POST
* @param {function} success
* @param {function} error
* @param {string|undefined} username
* @param {string|undefined} password
* @returns {jqXHR}
*/
function apirequest(action, data, success, error, username, password) {
return $.ajax({
url: SETTINGS.apiserver + action,
dataType: "json",
method: "POST",
data: data,
timeout: 10 * 1000,
beforeSend: function (xhr) {
if (typeof username === 'string' && typeof password === 'string') {
xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
}
},
success: function (val) {
if (typeof success == 'function') {
success(val);
}
},
error: function () {
if (typeof error == 'function') {
error();
}
}
});
}
/**
* Take a UNIX timestamp (seconds since Jan 1 1970) and format it.
* (Mostly) compatible with PHP's date() function.
* @param {String} date format string, see https://www.php.net/manual/en/function.date.php
* @param {Integer} timestamp UNIX timestamp
* @return {String}
*/
function formatTimestamp(format, timestamp) {
if (typeof timestamp == "undefined") {
timestamp = time();
}
var date = new Date(timestamp * 1000);
var out = "";
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
for (var i = 0; i < format.length; i++) {
var c = format.charAt(i);
// Handle backslash-escaped characters
if (c == "\\" && i < format.length - 1) {
out += format.charAt(i + 1);
i++;
continue;
}
switch (c) {
case "d":
var d = date.getDate();
if (d < 10) {
out += "0";
}
out += d;
break;
case "D":
out += days[date.getDay()].substring(0, 3);
break;
case "j":
out += date.getDate();
break;
case "l":
out += days[date.getDay()];
break;
case "N":
// TODO
break;
case "S":
// TODO
break;
case "w":
out += date.getDay();
break;
case "z":
// TODO
break;
case "W":
// TODO
break;
case "F":
out += months[date.getMonth()];
break;
case "m":
var m = date.getMonth() + 1;
if (m < 10) {
out += "0";
}
out += m;
break;
case "M":
out += months[date.getMonth()].substring(0, 3);
break;
case "n":
out += date.getMonth() + 1;
break;
case "t":
// TODO
break;
case "L":
// TODO
break;
case "o":
// TODO
break;
case "Y":
out += date.getFullYear();
break;
case "y":
var y = (date.getFullYear() + "");
out += y.substring(y.length - 2);
break;
case "a":
if (date.getHours() < 12) {
out += "am";
} else {
out += "pm";
}
break;
case "A":
if (date.getHours() < 12) {
out += "AM";
} else {
out += "PM";
}
break;
case "B":
// TODO
break;
case "g":
var h = date.getHours() % 12;
if (h == 0) {
h = 12;
}
out += h;
break;
case "G":
out += date.getHours();
break;
case "h":
var h = date.getHours() % 12;
if (h == 0) {
h = 12;
}
if (h < 10) {
out += "0";
}
out += h;
break;
case "H":
var h = date.getHours();
if (h < 10) {
out += "0";
}
out += h;
break;
case "i":
var ii = date.getMinutes();
if (ii < 10) {
out += "0";
}
out += ii;
break;
case "s":
var s = date.getSeconds();
if (s < 10) {
out += "0";
}
out += s;
break;
case "u":
out += date.getMilliseconds() * 1000;
break;
case "v":
out += date.getMilliseconds();
break;
case "e":
// TODO
break;
case "I":
// TODO
break;
case "O":
var off = date.getTimezoneOffset();
var m = off % 60;
var h = (off - m) / 60;
if (off >= 0) {
out += "+";
} else {
out += "-";
}
if (h < 10) {
out += "0";
}
out += h;
if (m < 10) {
out += "0";
}
out += m;
break;
case "P":
var off = date.getTimezoneOffset();
var m = off % 60;
var h = (off - m) / 60;
if (off >= 0) {
out += "+";
} else {
out += "-";
}
if (h < 10) {
out += "0";
}
out += h;
out += ":";
if (m < 10) {
out += "0";
}
out += m;
break;
case "T":
// TODO
break;
case "Z":
out += date.getTimezoneOffset() * 60;
break;
case "c":
out += formatTimestamp(timestamp, "Y-m-d\\TH:i:sP");
break;
case "r":
out += formatTimestamp(timestamp, "D, j M Y G:i:s O");
break;
case "U":
out += Math.round(timestamp);
break;
default:
out += c;
}
}
return out;
}
function timestampToDateTimeString(timestamp) {
return timestampToDateString(timestamp) + " " + timestampToTimeString(timestamp);
}
function timestampToDateString(timestamp) {
var date = new Date(timestamp * 1000);
return date.toLocaleDateString();
}
function timestampToTimeString(timestamp) {
var date = new Date(timestamp * 1000);
var pm = date.getHours() >= 12;
var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();
hours = (hours == 0 ? 12 : hours);
var minutes = date.getMinutes();
var time = hours + ":" + (minutes < 10 ? "0" + minutes : minutes) + " " + (pm ? "PM" : "AM");
return time;
}
/**
* Get the current UNIX timestamp in seconds.
* @returns {Number}
*/
function time() {
return Date.now() / 1000;
}
/**
* Get the number of seconds between now and the given timestamp.
* @param {Number} compareto
* @returns {Number}
*/
function timeDiff(compareto) {
return time() - compareto;
}

@ -0,0 +1,41 @@
<!DOCTYPE html>
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<title>App Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="assets/images/icons/logo.svg" />
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="node_modules/framework7/css/framework7.bundle.min.css" />
<link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-pro/css/all.min.css" />
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css" />
<link rel="stylesheet" href="node_modules/framework7-icons/css/framework7-icons.css" />
<link rel="stylesheet" href="assets/css/app.css" />
<link rel="stylesheet" href="assets/css/backdrop.css" />
<link rel="stylesheet" href="assets/css/oled.css" />
<link rel="stylesheet" href="assets/fonts/roboto/Roboto.css" />
<link rel="stylesheet" href="assets/css/tablet.css" />
<script src="cordova.js"></script>
<div id="app" class="color-theme-blue">
<div class="view view-main"></div>
</div>
<script src="node_modules/framework7/js/framework7.bundle.min.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="settings.js"></script>
<script src="assets/js/storage.js"></script>
<script src="assets/js/platform.js"></script>
<script src="assets/js/util.js"></script>
<script src="routes.js"></script>
<script src="assets/js/main.js"></script>

@ -0,0 +1,57 @@
{
"name": "App Template",
"short_name": "App",
"icons": [
{
"src": "assets/images/icons/32x32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "assets/images/icons/128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "assets/images/icons/144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "assets/images/icons/152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "assets/images/icons/192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/images/icons/256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "assets/images/icons/512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"scope": "/",
"lang": "en-US",
"categories": [""],
"prefer_related_applications": true,
"related_applications": [
{
"platform": "play",
"url": "https://play.google.com/store/apps/details?id=com.netsyms.template",
"id": "com.netsyms.template"
}
],
"start_url": "index.html",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#4CAF50",
"iarc_rating_id": ""
}

@ -0,0 +1,14 @@
{
"name": "AppTemplate",
"version": "1.0.0",
"main": "index.html",
"license": "MPL-2.0",
"dependencies": {
"@fortawesome/fontawesome-pro": "^5.13.0",
"framework7": "^5.5.1",
"framework7-icons": "^3.0.0",
"jquery": "^3.4.1",
"material-design-icons": "^3.0.1"
},
"devDependencies": {}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,40 @@
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="page" data-name="credits">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only back">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">Credits</div>
</div>
</div>
<div class="page-content">
<div class="block">
<p>This program is licensed under the Mozilla Public License 2.0.
To get the source code, visit https://source.netsyms.com/Netsyms/CommunityVotingApp.
<br>
This application relies on and is bundled with third-party code.
See below for the their licenses and where to find source code.
</div>
<div class="block">
<h2>Code and Libraries</h2>
<pre style="white-space: pre-line; overflow-wrap: break-word;">
{{credits}}
</pre>
</div>
</div>
</div>

@ -0,0 +1,26 @@
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="page" data-name="login">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only back">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">Log In</div>
</div>
</div>
<div class="page-content" style="overflow-y: hidden;"> <!-- overflow-y:hidden removes an annoying pointless scrollbar that wiggles a few pixels up and down -->
<iframe src="assets/iframeloading.html" id="loginframe" style="border: 0; width: 100%; height: calc(100vh - var(--f7-navbar-height));"></iframe>
</div>
<script src="assets/js/login.js"></script>
</div>

@ -0,0 +1,26 @@
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="page" data-name="main">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="title">Template App</div>
<div class="right">
<a class="link" href="/settings">
<i class="icon material-icons if-md">settings</i>
<i class="icon fas fa-cog if-not-md"></i>
</a>
</div>
</div>
</div>
<div class="page-content">
</div>
</div>

@ -0,0 +1,116 @@
<!--
Copyright 2020 Netsyms Technologies.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="page" data-name="settings">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only" onclick="router.back({force: true, ignoreCache: true})">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">{{page_title}}</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center">
<div class="col-100 medium-60 large-50 xlarge-40 elevation-tablet margin-top-tablet">
<div class="list media-list no-hairlines no-margin-top no-margin-bottom tablet-inset">
<ul>
{{#each settings}}
<li>
{{#if link}}
<div class="item-content item-link" data-setting="{{setting}}" onclick="{{onclick}}">
<div class="item-inner">
<div class="item-title-row">
<div class="item-title">{{title}}</div>
</div>
<div class="item-text">{{text}}</div>
</div>
</div>
{{else}}
{{#if toggle}}
<div class="item-content" data-setting="{{setting}}">
<div class="item-inner">
<div style="display: flex; justify-content: between;">
<div class="item-title">
{{title}}
</div>
<div class="item-after" onclick="{
{
onclick
}
}">
<label class="toggle toggle-init">
<input type="checkbox" {{#if checked}}checked{{/if}}>
<span class="toggle-icon"></span>
</label>
</div>
</div>
<div class="item-text">{{text}}</div>
</div>
</div>
{{else}}
{{#if slider}}
<div class="item-content" data-setting="{{setting}}">
<div class="item-inner">
<div class="item-title" style="background-color: rgba(0,0,0,0);">
{{title}}
</div>
<div class="item-subtitle padding-horizontal padding-top">
<div class="range-slider range-slider-init padding-top margin-top" data-label="true">
<input type="range" min="{{min}}" max="{{max}}" step="{{step}}" value="{{value}}">
</div>
</div>
</div>
</div>
{{else}}
{{#if select}}
<a class="item-link smart-select smart-select-init" data-open-in="popover" data-setting="{{setting}}">
<select>
{{#each options}}
<option value="{{value}}"{{#if selected}} selected{{/if}}>{{label}}</option>
{{/each}}
</select>
<div class="item-content">
<div class="item-inner">
<div class="item-title">{{title}}</div>
</div>
</div>
</a>
{{else}}
<div class="item-content" data-setting="{{setting}}" onclick="{
{
onclick
}
}">
<div class="item-inner">
<div class="item-title-row">
<div class="item-title">{{title}}</div>
</div>
<div class="item-text">{{text}}</div>
</div>
</div>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
</li>
{{/each}}
</ul>
</div>
</div>
</div>
</div>
<script src="assets/js/settings.js"></script>
</div>

@ -0,0 +1,153 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var routes = [
{
path: "/",
name: "main",
url: "pages/main.html"
},
{
path: "/login",
name: "login",
url: "pages/login.html"
},
{
path: '/settings',
name: 'settings',
async: function (routeTo, routeFrom, resolve, reject) {
var settings = [];
if (getStorage("username") != null && getStorage("password") != null) {
settings.push(
{
setting: "account",
title: "Account",
text: "Logged in as " + getStorage("username")
},
{
setting: "logout",
title: "",
text: "Log out",
link: true,
onclick: "logout()"
}
);
} else {
settings.push(
{
setting: "login",
title: "Log In",
text: "Sign up or log in.",
onclick: "router.navigate('/login')",
link: true
}
);
}
settings.push(
{
setting: "display",
title: "Display and Appearance",
text: "Change the app theme.",
onclick: "router.navigate('/settings/display')",
link: true
}
);
settings.push(
{
setting: "versions",
title: "Template app v" + app_version,
text: "Copyright &copy; 2020 Netsyms Technologies. Licensed under the Mozilla Public License 2.0.",
onclick: ""
},
{
setting: "opensource",
title: "Credits and open source info",
text: "",
onclick: "router.navigate('/credits')",
link: true
},
{
setting: "privacy",
title: "Privacy policy and legal",
text: "",
onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=TemplateApp')",
link: true
});
resolve({
templateUrl: './pages/settings.html'
}, {
context: {
page_title: "Settings",
settings: settings
}
});
},
routes: [
{
path: '/display',
name: 'settings',
async: function (routeTo, routeFrom, resolve, reject) {
var settings = [
{
setting: "apptheme",
title: "Color theme",
select: true,
options: [
{
value: "auto",
label: "Auto",
selected: getStorage("apptheme") == null || getStorage("apptheme") == "auto"
},
{
value: "dark",
label: "Dark",
selected: getStorage("apptheme") == "dark"
},
{
value: "light",
label: "Light",
selected: getStorage("apptheme") == "light"
}
]
},
{
setting: "animation",
title: "Animations",
select: true,
options: [
{
value: "auto",
label: "On",
selected: getStorage("animation") == null || getStorage("animation") == "auto" || getStorage("animation") == "on"
},
{
value: "off",
label: "Off",
selected: getStorage("animation") == "off"
}
]
}
];
resolve({
templateUrl: './pages/settings.html'
}, {
context: {
page_title: "Display Settings",
settings: settings
}
});
}
}
]
},
{
path: '/credits',
url: './pages/credits.html',
name: 'credits'
}
];

@ -0,0 +1,12 @@
/*
* Copyright 2020 Netsyms Technologies.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var SETTINGS = {
synckeyblacklist: [],
apiserver: "http://localhost/template/",
loginurl: "https://localhost/login/"
}
Loading…
Cancel
Save