PluginProbe
Hostinger Tools / 1.9.8
Hostinger Tools v1.9.8
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / src / js / main.js

main.js in Hostinger Tools 1.9.8, at src/js/main.js

116 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import './videos'
2
3 ( function ( $ ) {
4 $( document ).on( 'ready', function () {
5 const openClass = 'open';
6 let selectedTab = 'Home';
7 const stepsTitle = $( '.hsr-onboarding-step--title' )
8 const closeBtn = $( '.hsr-close-btn' );
9 const navigationItem = $( '.hsr-list__item' );
10 const knowledgeCard = $( '#card-knowledge' );
11 const helpCard = $( '#card-help' );
12
13 stepsTitle.on( 'click', function () {
14 $( this ).find( '.hsr-onboarding-step--expand' ).toggleClass( openClass );
15 $( this ).parent().find( '.hsr-onboarding-step--content' ).slideToggle( 200 );
16 } )
17
18 closeBtn.on( 'click', function () {
19 $( '.hsr-modal' ).removeClass( 'open' );
20 $( 'body' ).removeClass( 'modal-open' );
21 } )
22
23 navigationItem.click( function () {
24 let clickedItem = $( this );
25
26 $( '.hsr-list__item' ).removeClass( 'hsr-active' );
27
28 clickedItem.addClass( 'hsr-active' );
29 selectedTab = clickedItem.data( 'name' );
30
31 $( '.hsr-tab-content' ).hide();
32 $( '.hsr-tab-content[data-name="' + selectedTab + '"]' ).show();
33
34 add_admin_menu_class();
35 } );
36
37 if( window.location.hash ) {
38 let tab = $( '.hsr-onboarding-navbar .hsr-wrapper__list .hsr-list__item[data-name="' + window.location.hash.split('#')[1] + '"]' )
39
40 if(tab.length > 0) {
41 $( '.hsr-list__item' ).removeClass( 'hsr-active' );
42 tab.addClass( 'hsr-active' );
43
44 $( '.hsr-tab-content' ).hide();
45 $( '.hsr-tab-content[data-name="' + window.location.hash.split('#')[1] + '"]' ).show();
46 }
47 } else {
48
49 $( '.hsr-wrapper__list .hsr-list__item:first-of-type' ).addClass( 'hsr-active' );
50
51 }
52
53 helpCard.click( function () {
54 window.open( 'https://hostinger.com/cpanel-login?r=jump-to/new-panel/section/help', '_blank' );
55 } );
56 knowledgeCard.click( function () {
57 window.open( 'https://support.hostinger.com/en/?q=WordPress', '_blank' );
58 } );
59
60 document.querySelectorAll( '.hsr-playlist-item' ).forEach( function ( item ) {
61 const firstItem = document.querySelector( '.hsr-playlist-item:first-child' );
62 firstItem.classList.add( 'hsr-active-video' );
63 firstItem.querySelector( '.hsr-playlist-item-arrow' ).style.visibility = 'visible';
64 item.addEventListener( 'click', function () {
65 document.querySelectorAll( '.hsr-playlist-item.hsr-active-video' ).forEach( function ( selectedItem ) {
66 selectedItem.classList.remove( 'hsr-active-video' );
67 selectedItem.querySelector( '.hsr-playlist-item-arrow' ).style.visibility = 'hidden';
68 } );
69 this.classList.add( 'hsr-active-video' );
70 this.querySelector( '.hsr-playlist-item-arrow' ).style.visibility = 'visible';
71 } );
72 } );
73
74 function add_admin_menu_class () {
75 const hostingerSubMenu = document.querySelectorAll( '#toplevel_page_hostinger .wp-submenu li' );
76
77 if ( hostingerSubMenu ) {
78 hostingerSubMenu.forEach( item => {
79 item.classList.remove( 'current' );
80 } );
81
82 const tabSelectors = document.querySelectorAll( '.hsr-onboarding-navbar .hsr-wrapper__list .hsr-list__item' );
83
84 tabSelectors.forEach( ( item, index ) => {
85 if ( item.classList.contains( 'hsr-active' ) ) {
86 if ( typeof hostingerSubMenu[ index + 1 ] !== "undefined" ) {
87 hostingerSubMenu[ index + 1 ].classList.add( 'current' );
88 }
89 }
90 } );
91 }
92 }
93
94 add_admin_menu_class();
95
96 // Copy nameservers to clipboard
97 $(document).ready(function() {
98 $('.hts-nameservers svg').click(function() {
99 let textToCopy = $(this).closest('div').find('b').text();
100 copyTextToClipboard(textToCopy);
101 });
102 });
103
104 function copyTextToClipboard(text) {
105 let textArea = document.createElement('textarea');
106 textArea.value = text;
107 document.body.appendChild(textArea);
108 textArea.select();
109 document.execCommand('copy');
110 document.body.removeChild(textArea);
111 }
112
113 } );
114
115 } )( jQuery );
116