cordova integration: small fixups

This commit is contained in:
Lorenz Hübschle-Schneider 2017-04-19 14:55:48 +02:00
parent 307a6a5344
commit 8ba2b1acf6
2 changed files with 4 additions and 6 deletions

View file

@ -137,10 +137,9 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) {
weechat.filter('linksForCordova', ['$sce', function($sce) { weechat.filter('linksForCordova', ['$sce', function($sce) {
return function(text) { return function(text) {
if (window.cordova !== undefined) { // Cordova: need to use window.open instead of href
text = text.replace(/<a (rel="[a-z ]+"\s)?(?:target="_[a-z]+"\s)?href="([^"]+)"/gi, "<a $1 onClick=\"window.open('$2', '_system')\""); // XXX TODO this needs to be improved
} text = text.replace(/<a (rel="[a-z ]+"\s)?(?:target="_[a-z]+"\s)?href="([^"]+)"/gi, "<a $1 onClick=\"window.open('$2', '_system')\"");
return $sce.trustAsHtml(text); return $sce.trustAsHtml(text);
}; };
}]); }]);

View file

@ -29,7 +29,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.command = ''; $scope.command = '';
$scope.themes = ['dark', 'light', 'black', 'dark-spacious', 'blue', 'base16-default', 'base16-light', 'base16-mocha', 'base16-solarized-dark', 'base16-solarized-light']; $scope.themes = ['dark', 'light', 'black', 'dark-spacious', 'blue', 'base16-default', 'base16-light', 'base16-mocha', 'base16-solarized-dark', 'base16-solarized-light'];
$scope.utils = utils;
// Initialise all our settings, this needs to include all settings // Initialise all our settings, this needs to include all settings
// or else they won't be saved to the localStorage. // or else they won't be saved to the localStorage.
@ -821,7 +820,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.disconnect(); $scope.disconnect();
} }
if (cordova !== undefined) { if (window.cordova !== undefined) {
$scope.favico.reset(); $scope.favico.reset();
} }
} }