From 2504f8ad358e2875b359e269e52f971ffa5c31a7 Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 26 Mar 2015 09:50:07 -0400 Subject: [PATCH] #1013: Firefox support --- platform/firefox/vapi-background.js | 13 +++++--- src/js/i18n.js | 51 ++++++++++++++++++----------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 9d7b3dcd2..0bd5c23b4 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1119,13 +1119,18 @@ var httpObserver = { return true; } - /*if ( result.redirectUrl ) { - channel.redirectionLimit = 1; + if ( result.redirectUrl ) { + if ( type === 'main_frame' ) { + channel.cancel(this.ABORT); + vAPI.tabs.open({ tabId: details.tabId, url: result.redirectUrl }); + return true; + } + /*channel.redirectionLimit = 1; channel.redirectTo( Services.io.newURI(result.redirectUrl, null, null) ); - return true; - }*/ + return true;*/ + } return false; }, diff --git a/src/js/i18n.js b/src/js/i18n.js index 8d42cbf8e..36a356e9d 100644 --- a/src/js/i18n.js +++ b/src/js/i18n.js @@ -20,7 +20,13 @@ */ /* global vAPI, uDom */ -/* exported renderElapsedTime */ + +/******************************************************************************/ + +// This file should always be included at the end of the `body` tag, so as +// to ensure all i18n targets are already loaded. + +(function() { 'use strict'; @@ -28,25 +34,26 @@ // Helper to deal with the i18n'ing of HTML files. -uDom.onLoad(function() { - uDom('[data-i18n]').forEach(function(elem) { - elem.html(vAPI.i18n(elem.attr('data-i18n'))); - }); - uDom('[title]').forEach(function(elem) { - var title = vAPI.i18n(elem.attr('title')); - if ( title ) { - elem.attr('title', title); - } - }); - uDom('[placeholder]').forEach(function(elem) { - elem.attr('placeholder', vAPI.i18n(elem.attr('placeholder'))); - }); - uDom('[data-i18n-tip]').forEach(function(elem) { - elem.attr( - 'data-tip', - vAPI.i18n(elem.attr('data-i18n-tip')).replace(/
/g, '') - ); - }); +uDom('[data-i18n]').forEach(function(elem) { + elem.html(vAPI.i18n(elem.attr('data-i18n'))); +}); + +uDom('[title]').forEach(function(elem) { + var title = vAPI.i18n(elem.attr('title')); + if ( title ) { + elem.attr('title', title); + } +}); + +uDom('[placeholder]').forEach(function(elem) { + elem.attr('placeholder', vAPI.i18n(elem.attr('placeholder'))); +}); + +uDom('[data-i18n-tip]').forEach(function(elem) { + elem.attr( + 'data-tip', + vAPI.i18n(elem.attr('data-i18n-tip')).replace(/
/g, '') + ); }); /******************************************************************************/ @@ -74,3 +81,7 @@ vAPI.i18n.renderElapsedTimeToString = function(tstamp) { }; /******************************************************************************/ + +})(); + +/******************************************************************************/