PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.1
JetFormBuilder — Dynamic Blocks Form Builder v3.1.1
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / assets / src / admin-package / functions / LocationManager.js
jetformbuilder / assets / src / admin-package / functions Last commit date
LocalStorage.js 2 years ago LocationManager.js 2 years ago RenderCurrentPage.js 2 years ago resolveRestUrl.js 2 years ago
LocationManager.js
81 lines
1 export function getCurrentPath() {
2 return window.location.pathname;
3 }
4
5 export function getRawSearch() {
6 return window.location.search;
7 }
8
9 export function getSearch() {
10 const args = {};
11 getRawSearch().replace( '?', '' ).split( '&' ).forEach( pair => {
12 const [ name, value ] = pair.split( '=' );
13
14 args[ name ] = value;
15 } );
16
17 return args;
18 }
19
20 function prepareQueryArgs( key, value ) {
21 if ( 'object' !== typeof value ) {
22 return [
23 [ key, value ],
24 ];
25 }
26
27 const response = [];
28
29 for ( let [ valueKey, valueItem ] of Object.entries( value ) ) {
30 valueKey = `${ key }[${ valueKey }]`;
31
32 response.push( ...prepareQueryArgs( valueKey, valueItem ) );
33 }
34
35 return response;
36 }
37
38 /**
39 * @param args {Object}
40 * @param url {module:url.URL}
41 * @returns {string}
42 */
43 export function addQueryArgs( args, url ) {
44 url = new URL( url );
45
46 const params = new URLSearchParams( url.search );
47 const pairs = [];
48
49 for ( const [ key, value ] of Object.entries( args ) ) {
50 pairs.push( ...prepareQueryArgs( key, value ) );
51 }
52
53 for ( const [ key, value ] of pairs ) {
54 if ( !value ) {
55 continue;
56 }
57 params.append( key, value );
58 }
59
60 return url.origin + url.pathname + '?' + params;
61 }
62
63 export function createPath( queryArgs = {}, hashes = {}, clearArgs = [] ) {
64 const params = [];
65 queryArgs = {
66 ...getSearch(),
67 ...queryArgs,
68 };
69
70 for ( const [ key, value ] of Object.entries( queryArgs ) ) {
71 if ( clearArgs.includes( key ) ) {
72 continue;
73 }
74 params.push( `${ key }=${ encodeURIComponent( value ) }` );
75 }
76
77 const urlParts = [ getCurrentPath(), params.join( '&' ) ];
78
79 return urlParts.filter( part => part ).join( '?' );
80
81 }