mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
fix #1641
This commit is contained in:
parent
b68c4f8f85
commit
da163bbe4b
6 changed files with 25 additions and 11 deletions
|
@ -127,9 +127,8 @@ var exportUserFiltersToFile = function() {
|
|||
if ( val === '' ) {
|
||||
return;
|
||||
}
|
||||
var now = new Date();
|
||||
var filename = vAPI.i18n('1pExportFilename')
|
||||
.replace('{{datetime}}', now.toLocaleString())
|
||||
.replace('{{datetime}}', uBlockDashboard.dateNowToSensibleString())
|
||||
.replace(/ +/g, '_');
|
||||
vAPI.download({
|
||||
'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(val + '\n'),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014 Raymond Hill
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -103,6 +103,15 @@ self.uBlockDashboard.mergeNewLines = function(text, newText) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
self.uBlockDashboard.dateNowToSensibleString = function() {
|
||||
var now = new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000);
|
||||
return now.toISOString().replace(/\.\d+Z$/, '')
|
||||
.replace(/:/g, '.')
|
||||
.replace('T', '_');
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Open links in the proper window
|
||||
uDom('a').attr('target', '_blank');
|
||||
uDom('a[href*="dashboard.html"]').attr('target', '_parent');
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
Home: https://github.com/gorhill/uMatrix
|
||||
*/
|
||||
|
||||
/* global uDom */
|
||||
/* global uDom, uBlockDashboard */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -153,9 +153,8 @@ var startImportFilePicker = function() {
|
|||
/******************************************************************************/
|
||||
|
||||
function exportUserRulesToFile() {
|
||||
var now = new Date();
|
||||
var filename = vAPI.i18n('rulesDefaultFileName')
|
||||
.replace('{{datetime}}', now.toLocaleString())
|
||||
.replace('{{datetime}}', uBlockDashboard.dateNowToSensibleString())
|
||||
.replace(/ +/g, '_');
|
||||
vAPI.download({
|
||||
'url': 'data:text/plain,' + encodeURIComponent(rulesFromHTML('#diff .left li') + '\n'),
|
||||
|
|
|
@ -745,9 +745,8 @@ var backupUserData = function(callback) {
|
|||
var onSelectedListsReady = function(filterLists) {
|
||||
userData.filterLists = filterLists;
|
||||
|
||||
var now = new Date();
|
||||
var filename = vAPI.i18n('aboutBackupFilename')
|
||||
.replace('{{datetime}}', now.toLocaleString())
|
||||
.replace('{{datetime}}', µb.dateNowToSensibleString())
|
||||
.replace(/ +/g, '_');
|
||||
|
||||
vAPI.download({
|
||||
|
|
|
@ -135,6 +135,15 @@
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.dateNowToSensibleString = function() {
|
||||
var now = new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000);
|
||||
return now.toISOString().replace(/\.\d+Z$/, '')
|
||||
.replace(/:/g, '.')
|
||||
.replace('T', '_');
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.LineIterator = function(text, offset) {
|
||||
this.text = text;
|
||||
this.textLen = this.text.length;
|
||||
|
|
|
@ -96,9 +96,8 @@ var exportWhitelistToFile = function() {
|
|||
if ( val === '' ) {
|
||||
return;
|
||||
}
|
||||
var now = new Date();
|
||||
var filename = vAPI.i18n('whitelistExportFilename')
|
||||
.replace('{{datetime}}', now.toLocaleString())
|
||||
.replace('{{datetime}}', uBlockDashboard.dateNowToSensibleString())
|
||||
.replace(/ +/g, '_');
|
||||
vAPI.download({
|
||||
'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(val + '\n'),
|
||||
|
|
Loading…
Reference in a new issue