From 56d190ab5c3bc436758de4f17980bec9aa9950c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sun, 23 Apr 2017 14:34:12 +0200 Subject: [PATCH] Improve documentation & cordova checks --- js/filters.js | 6 ++++-- js/glowingbear.js | 32 ++++++++++++++++++-------------- js/notifications.js | 13 ++++++------- js/utils.js | 5 +++++ manifest.json | 4 ++-- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/js/filters.js b/js/filters.js index e412cd2..00a867e 100644 --- a/js/filters.js +++ b/js/filters.js @@ -135,11 +135,13 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) { }; }]); +// This is used by the cordova app to change link targets to "window.open(, '_system')" +// so that they're opened in a browser window and don't navigate away from Glowing Bear weechat.filter('linksForCordova', ['$sce', function($sce) { return function(text) { - // Cordova: need to use window.open instead of href // XXX TODO this needs to be improved - text = text.replace(/'; document.getElementById("soundNotification").innerHTML = soundHTML; diff --git a/js/utils.js b/js/utils.js index 350f5c0..854372b 100644 --- a/js/utils.js +++ b/js/utils.js @@ -21,6 +21,10 @@ weechat.factory('utils', function() { return (document.body.clientWidth < mobile_cutoff); }; + var isCordova = function() { + return window.cordova !== undefined; + }; + // Inject a javascript (used by KaTeX) var inject_script = function(script_url) { @@ -46,6 +50,7 @@ weechat.factory('utils', function() { changeClassStyle: changeClassStyle, getClassStyle: getClassStyle, isMobileUi: isMobileUi, + isCordova: isCordova, inject_script: inject_script, inject_css: inject_css, }; diff --git a/manifest.json b/manifest.json index fbe73c8..793e2fd 100644 --- a/manifest.json +++ b/manifest.json @@ -9,11 +9,11 @@ }, "app": { "urls": [ - "http://www.glowing-bear.org/" + "https://www.glowing-bear.org/" ], "launch": { "container": "panel", - "web_url": "http://www.glowing-bear.org/" + "web_url": "https://www.glowing-bear.org/" } }, "permissions": [