@@ -3,12 +3,12 @@ import { AJAX } from './modules/ajax.js';
33import { Functions } from './modules/functions.js' ;
44import { Navigation } from './modules/navigation.js' ;
55import { CommonParams } from './modules/common.js' ;
6- import { Config } from './modules/config.js' ;
76import highlightSql from './modules/sql-highlight.js' ;
87import { ajaxRemoveMessage , ajaxShowMessage } from './modules/ajax-message.js' ;
98import createProfilingChart from './modules/functions/createProfilingChart.js' ;
109import { escapeHtml } from './modules/functions/escape.js' ;
1110import refreshMainContent from './modules/functions/refreshMainContent.js' ;
11+ import isStorageSupported from './modules/functions/isStorageSupported.js' ;
1212
1313/**
1414 * @fileoverview functions used wherever an sql query form is used
@@ -54,7 +54,7 @@ Sql.urlEncode = function (str) {
5454Sql . autoSave = function ( query ) {
5555 if ( query ) {
5656 var key = Sql . getAutoSavedKey ( ) ;
57- if ( Config . isStorageSupported ( 'localStorage' ) ) {
57+ if ( isStorageSupported ( 'localStorage' ) ) {
5858 window . localStorage . setItem ( key , query ) ;
5959 } else {
6060 window . Cookies . set ( key , query , { path : CommonParams . get ( 'rootPath' ) } ) ;
@@ -76,7 +76,7 @@ Sql.showThisQuery = function (db, table, query) {
7676 'table' : table ,
7777 'query' : query
7878 } ;
79- if ( Config . isStorageSupported ( 'localStorage' ) ) {
79+ if ( isStorageSupported ( 'localStorage' ) ) {
8080 window . localStorage . showThisQuery = 1 ;
8181 window . localStorage . showThisQueryObject = JSON . stringify ( showThisQueryObject ) ;
8282 } else {
@@ -92,7 +92,7 @@ Sql.showThisQuery = function (db, table, query) {
9292Sql . setShowThisQuery = function ( ) {
9393 var db = $ ( 'input[name="db"]' ) . val ( ) ;
9494 var table = $ ( 'input[name="table"]' ) . val ( ) ;
95- if ( Config . isStorageSupported ( 'localStorage' ) ) {
95+ if ( isStorageSupported ( 'localStorage' ) ) {
9696 if ( window . localStorage . showThisQueryObject !== undefined ) {
9797 var storedDb = JSON . parse ( window . localStorage . showThisQueryObject ) . db ;
9898 var storedTable = JSON . parse ( window . localStorage . showThisQueryObject ) . table ;
@@ -122,7 +122,7 @@ Sql.setShowThisQuery = function () {
122122 */
123123Sql . autoSaveWithSort = function ( query ) {
124124 if ( query ) {
125- if ( Config . isStorageSupported ( 'localStorage' ) ) {
125+ if ( isStorageSupported ( 'localStorage' ) ) {
126126 window . localStorage . setItem ( 'autoSavedSqlSort' , query ) ;
127127 } else {
128128 window . Cookies . set ( 'autoSavedSqlSort' , query , { path : CommonParams . get ( 'rootPath' ) } ) ;
@@ -136,7 +136,7 @@ Sql.autoSaveWithSort = function (query) {
136136 * @return {void }
137137 */
138138Sql . clearAutoSavedSort = function ( ) {
139- if ( Config . isStorageSupported ( 'localStorage' ) ) {
139+ if ( isStorageSupported ( 'localStorage' ) ) {
140140 window . localStorage . removeItem ( 'autoSavedSqlSort' ) ;
141141 } else {
142142 window . Cookies . set ( 'autoSavedSqlSort' , '' , { path : CommonParams . get ( 'rootPath' ) } ) ;
@@ -309,7 +309,7 @@ const insertQuery = function (queryType) {
309309 key += '.' + table ;
310310 }
311311 key = 'autoSavedSql_' + key ;
312- if ( Config . isStorageSupported ( 'localStorage' ) &&
312+ if ( isStorageSupported ( 'localStorage' ) &&
313313 typeof window . localStorage . getItem ( key ) === 'string' ) {
314314 setQuery ( window . localStorage . getItem ( key ) ) ;
315315 } else if ( window . Cookies . get ( key , { path : CommonParams . get ( 'rootPath' ) } ) ) {
@@ -471,7 +471,7 @@ AJAX.registerOnload('sql.js', function () {
471471 $ ( '#sqlquery' ) . on ( 'input propertychange' , function ( ) {
472472 Sql . autoSave ( $ ( '#sqlquery' ) . val ( ) ) ;
473473 } ) ;
474- var useLocalStorageValue = Config . isStorageSupported ( 'localStorage' ) && typeof window . localStorage . autoSavedSqlSort !== 'undefined' ;
474+ var useLocalStorageValue = isStorageSupported ( 'localStorage' ) && typeof window . localStorage . autoSavedSqlSort !== 'undefined' ;
475475 // Save sql query with sort
476476 if ( $ ( '#RememberSorting' ) !== undefined && $ ( '#RememberSorting' ) . is ( ':checked' ) ) {
477477 $ ( 'select[name="sql_query"]' ) . on ( 'change' , function ( ) {
@@ -1219,7 +1219,7 @@ Sql.getAutoSavedKey = function () {
12191219Sql . checkSavedQuery = function ( ) {
12201220 var key = Sql . getAutoSavedKey ( ) ;
12211221
1222- if ( Config . isStorageSupported ( 'localStorage' ) &&
1222+ if ( isStorageSupported ( 'localStorage' ) &&
12231223 typeof window . localStorage . getItem ( key ) === 'string' ) {
12241224 ajaxShowMessage ( window . Messages . strPreviousSaveQuery ) ;
12251225 } else if ( window . Cookies . get ( key , { path : CommonParams . get ( 'rootPath' ) } ) ) {
0 commit comments