PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / trunk
Starter Sites & Templates by Neve vtrunk
1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / assets / src / utils / common.js
templates-patterns-collection / assets / src / utils Last commit date
common.js 2 years ago rest.js 3 years ago site-import.js 2 years ago
common.js
94 lines
1 import { __ } from '@wordpress/i18n';
2
3 const addUrlHash = ( hash ) => {
4 window.location.hash = hash;
5 };
6
7 const getTabHash = ( tabs ) => {
8 let hash = window.location.hash;
9
10 if ( 'string' !== typeof window.location.hash ) {
11 return null;
12 }
13
14 hash = hash.substring( 1 );
15
16 if ( ! Object.keys( tabs ).includes( hash ) ) {
17 return null;
18 }
19
20 return hash;
21 };
22
23 const untrailingSlashIt = ( str ) => str.replace( /\/$/, '' );
24 const trailingSlashIt = ( str ) => untrailingSlashIt( str ) + '/';
25
26 const isTabbedEditor = false;
27
28 const TAGS = [
29 __( 'Business', 'templates-patterns-collection' ),
30 __( 'Ecommerce', 'templates-patterns-collection' ),
31 __( 'Fashion', 'templates-patterns-collection' ),
32 __( 'Blogging', 'templates-patterns-collection' ),
33 __( 'Photography', 'templates-patterns-collection' ),
34 ];
35 const CATEGORIES = {
36 all: __( 'All Categories', 'templates-patterns-collection' ),
37 free: __( 'Free', 'templates-patterns-collection' ),
38 business: __( 'Business', 'templates-patterns-collection' ),
39 portfolio: __( 'Portfolio', 'templates-patterns-collection' ),
40 woocommerce: __( 'WooCommerce', 'templates-patterns-collection' ),
41 blog: __( 'Blog', 'templates-patterns-collection' ),
42 personal: __( 'Personal', 'templates-patterns-collection' ),
43 other: __( 'Other', 'templates-patterns-collection' ),
44 };
45 const EDITOR_MAP = {
46 gutenberg: {
47 icon: 'gutenberg.jpg',
48 niceName: 'Gutenberg',
49 },
50 elementor: {
51 icon: 'elementor.jpg',
52 niceName: 'Elementor',
53 },
54 };
55
56 const EDITOR_MAP_ARCHIVED = {
57 'beaver builder': {
58 icon: 'beaver.jpg',
59 niceName: (
60 <>
61 Beaver <span className="long-name">Builder</span>
62 </>
63 ),
64 },
65 brizy: {
66 icon: 'brizy.jpg',
67 niceName: 'Brizy',
68 },
69 'divi builder': {
70 icon: 'divi.jpg',
71 niceName: 'Divi',
72 },
73 'thrive architect': {
74 icon: 'thrive.jpg',
75 niceName: (
76 <>
77 Thrive <span className="long-name">Architect</span>
78 </>
79 ),
80 },
81 };
82
83 export {
84 addUrlHash,
85 getTabHash,
86 trailingSlashIt,
87 untrailingSlashIt,
88 isTabbedEditor,
89 CATEGORIES,
90 EDITOR_MAP,
91 EDITOR_MAP_ARCHIVED,
92 TAGS,
93 };
94