PageSourceSearch

https://www.wealthysinglemommy.com/wp-content/themes/wealthy-single-mommy/js/shero.js?ver=1.1

js wealthysinglemommy.com collected 2026-10-03 21:41:51 UTC 18,391 bytes, 490 lines download raw bytes

1jQuery(window).load(function () {
2    var post_author_box = jQuery(".saboxplugin-wrap");
3    post_author_box.insertBefore(".fl-comments");
4});
5jQuery(window).load(function(){
6    setTimeout(function () {
7        var vidDefer = document.getElementsByTagName('iframe');
8        for (var i=0; i<vidDefer.length; i++) {
9            if(vidDefer[i].getAttribute('data-src')) {
10                vidDefer[i].setAttribute('src',vidDefer[i].getAttribute('data-src'));
11            }
12        }
13
14        var imgDefer = document.getElementsByTagName('img');
15        for (var i=0; i<imgDefer.length; i++) {
16            if(imgDefer[i].getAttribute('data-src')) {
17                imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('data-src'));
18            }
19        }
20    },5000);
21
22	
23    const todayDate = jQuery("span#todays-date");
24        // Current date
25        const monthNames = ["January", "February", "March", "April", "May", "June",
26            "July", "August", "September", "October", "November", "December"
27        ];
28        var today = new Date();
29        var dd = String(today.getDate()).padStart(2, '0');
30        var mm = monthNames[today.getMonth()]; //January is 0!
31        var yyyy = today.getFullYear();
32
33        switch (mm) {
34            case 'January':
35                mm = 'Jan.';
36                break;
37            case 'February':
38                mm = 'Feb.';
39                break
40            case 'August':
41                mm = 'Aug.';
42                break 
43            case 'September':
44                mm = 'Sept.';
45                break
46            case 'October':
47                mm = 'Oct.';
48                break
49            case 'November':
50                mm = 'Nov.';
51                break
52            case 'December':
53                mm = 'Dec.';
54                break
55            default:
56                break;
57        }
58
59        today = mm + ' ' + (dd[0] === '0' ? dd[1] : dd) + ', ' + yyyy;
60
61        todayDate.each(function() {
62            todayDate.html(today);
63        });
64
65    jQuery('.menu-wrapper .mobile-menu .menu-item.menu-item-has-children .sub-menu-toggle').click(function(e){
66        // e.preventDefault();
67        // Get the clicked element parent
68        let current_element = jQuery(this);
69        jQuery(".menu-wrapper .mobile-menu .menu-item.menu-item-has-children").not(current_element).parent().parent().removeClass("show_links");
70        if (current_element.hasClass('active')) {
71            current_element.parent().parent().removeClass('show_links')
72        } else {
73            current_element.parent().parent().addClass('show_links')
74        }
75    });
76
77    //Add CSS Class to the sticky header when scroll down on mobile
78    let doc = document.documentElement;
79    let w = window;
80
81    let prevScroll = w.scrollY || doc.scrollTop;
82    let curScroll;
83    let direction = 0;
84    let prevDirection = 0;
85
86    let header = document.getElementById('site-header');
87
88    let checkScroll = function() {
89
90        /*
91        ** Find the direction of scroll
92        ** 0 - initial, 1 - up, 2 - down
93        */
94
95        curScroll = w.scrollY || doc.scrollTop;
96        if (curScroll > prevScroll) {
97            //scrolled up
98            direction = 2;
99        }
100        else if (curScroll < prevScroll) {
101            //scrolled down
102            direction = 1;
103        }
104
105        if (direction !== prevDirection) {
106            toggleHeader(direction, curScroll);
107        }
108
109        prevScroll = curScroll;
110    };
111
112    let toggleHeader = function(direction, curScroll) {
113        if (direction === 2 && curScroll > 52) {
114
115            //replace 52 with the height of your header in px
116
117            header.classList.add('hide');
118            prevDirection = direction;
119        }
120        else if (direction === 1) {
121            header.classList.remove('hide');
122            prevDirection = direction;
123        }
124    };
125
126    window.addEventListener('scroll', checkScroll);
127
128    //Open all external links in new tab
129    function externalLinks() {
130        for ( let c = document.getElementsByTagName("a"), a = 0;a < c.length; a++ ) {
131            let b = c[a];
132            b.getAttribute("href") && b.hostname !== location.hostname && (b.target = "_blank")
133        }
134    }
135    externalLinks();
136
137    //Add max-height on all iframes
138    let pageIframes = jQuery('.singular iframe');
139    if ( pageIframes ) {
140        pageIframes.each( function(){
141            let maxHeight= jQuery(this).attr("height");
142            let maxWidth= jQuery(this).attr("width");
143
144            if ( maxHeight ) {
145                jQuery(this).css('max-height', + maxHeight );
146            }
147
148            if ( maxWidth ) {
149                jQuery(this).css('max-width', + maxWidth );
150            }
151
152        });
153    }
154});
155
156// read more button:
157jQuery(document).ready(function( $ ) {
158
159    $(".read-more-toggle-btn").each(function() {
160		console.log("this", this)
161        let allBetween = $(this).nextUntil(".read-less-toggle-btn");
162        let readLess = $(this).nextUntil(".read-less-toggle-btn").last().next('.read-less-toggle-btn');
163        let readMore = $(this);
164
165        allBetween.addClass('readmore-hide');
166        readLess.addClass('readmore-hide');
167
168        $(this).find('button').on('click', function() {    
169            allBetween.removeClass('readmore-hide');
170            $(this).parent().addClass('readmore-hide');
171
172            if (readLess.length) {
173                readLess.removeClass('readmore-hide');
174            }
175        });
176
177        readLess.find('button').on('click', function() {
178            allBetween.addClass('readmore-hide')
179            $(this).parent().addClass('readmore-hide');
180            readMore.removeClass('readmore-hide');
181        })
182    })
183
184});
185
186// OptiMonk Script
187if (document.querySelector('body.home')) {
188    addOptimonkScript()     
189} else {
190    setTimeout(function() {
191        addOptimonkScript();
192    }, 15000);   
193}
194
195    
196function addOptimonkScript() {
197    (function(e, a) {
198        var t, r = e.getElementsByTagName("head")[0], c = e.location.protocol;
199        t = e.createElement("script");
200        t.type = "text/javascript";
201        t.charset = "utf-8";
202        t.async = !0;
203        t.defer = !0;
204        t.src = c + "//front.optimonk.com/public/" + a + "/js/preload.js";
205        r.appendChild(t);
206    })(document, "127424");  
207}
208
209document.addEventListener('DOMContentLoaded', function() {
210    const searchZipCodeButton = document.querySelectorAll('.search-zip');
211    const zipError = document.querySelectorAll('.zip-search-error');
212    const zipCode = document.querySelectorAll('.zip-code-input');
213
214    if(searchZipCodeButton) {
215        for(let i=0; i<= searchZipCodeButton.length; i++) {
216            searchZipCodeButton[i]?.addEventListener('click', () => {
217                let searchKeyword = searchZipCodeButton[i].value;
218                let zipValue = zipCode[i].value;
219                let lat, lng;
220                fetch(`https://maps.googleapis.com/maps/api/geocode/json?address=${zipValue}&key=AIzaSyDRy3qE73nnXQBWdewIwWedtZGmOHz4R_s`)
221                .then(response => {
222                    return response.json();
223                })
224                .then(data => {
225                    if(data.results[0] && data.results[0].geometry !== undefined) {
226                        lat = data.results[0].geometry.location.lat;
227                        lng = data.results[0].geometry.location.lng;
228                        zipError[i].setAttribute('style', 'display: none;')
229                        window.open(`https://www.google.com/maps/search/${searchKeyword}/@${lat},${lng},10z`, "_blank");
230                    } else {
231                        zipError[i].innerHTML = 'Please enter a United States ZIP Code.';
232                        zipError[i].setAttribute('style', 'display: block;')
233                    }
234                })
235            })
236        }
237    }
238}, false);
239
240
241document.addEventListener('DOMContentLoaded', function() {
242    const priceOuncePlatinum = document.querySelectorAll("#platinum-1-ounce");
243    const priceGramPlatinum = document.querySelectorAll("#platinum-1-gram");
244    const priceOuncePalladium = document.querySelectorAll("#palladium-1-ounce");
245    const priceGramPalladium = document.querySelectorAll("#palladium-1-gram");
246    const priceOunceRhodium = document.querySelectorAll("#rhodium-1-ounce");
247    const priceGramRhodium = document.querySelectorAll("#rhodium-1-gram");
248    const priceOunceCopper = document.querySelectorAll("#copper-1-ounce");
249    const priceGramCopper = document.querySelectorAll("#copper-1-gram");
250    const priceOunceAluminum = document.querySelectorAll("#aluminum-1-ounce");
251    const priceGramAluminum = document.querySelectorAll("#aluminum-1-gram");
252
253    // Gold Price
254    const priceOunceGold = jQuery("span#gold-1-ounce");
255    const priceGramGold = jQuery("span#gold-1-gram");
256
257    const priceOunceSilver = jQuery("span#silver-1-ounce");
258    const priceGramSilver = jQuery("span#silver-1-gram");
259
260    const goldPriceOunce24k = document.querySelector("span#gold-1-ounce-24k");
261    const goldPriceOunce22k = document.querySelector("span#gold-1-ounce-22k");
262    const goldPriceOunce18k = document.querySelector("span#gold-1-ounce-18k");
263    const goldPriceOunce14k = document.querySelector("span#gold-1-ounce-14k");
264    const goldPriceOunce9k = document.querySelector("span#gold-1-ounce-9k");
265    const troyOuncePrice = document.querySelector("span#gold-troy-1-ounce");
266    let metalsData;
267
268    if(priceOuncePlatinum.length > 0 || 
269        priceGramPlatinum.length > 0 ||
270        priceOuncePalladium.length > 0 || 
271        priceGramPalladium.length > 0 ||
272        priceOunceRhodium.length > 0 || 
273        priceGramRhodium.length > 0 || 
274        priceOunceCopper.length > 0 || 
275        priceGramCopper.length > 0 || 
276        priceOunceAluminum.length > 0 || 
277        priceGramAluminum.length > 0 ||
278        priceOunceGold.length > 0 || 
279        priceGramGold.length > 0 ||
280        priceOunceSilver.length > 0 || 
281        priceGramSilver.length > 0 ) {
282            metalsData = fetch('https://metals-api.com/api/latest?access_key=2rtzyc866o978uhekorzunuwedx5qef95mhcvt49rjt3hw5o9rnyrsokg4qt&base=USD&symbols=XPT%2CXPD%2CXRH%2CXCU%2CALU%2CXAU%2CXAG%2CLBXAUAM%2CLBXAUPM%2CLBXAG')
283            .then(response => {
284                return response.json()
285            })
286            .then(data => {
287                return data;
288            })
289        }
290
291    const setMetalPrices = async (metal, ouncePrice, gramPrice, data) => {
292        const theData = await data;
293        let metalPrice;
294        switch (metal){
295            case 'platinum':
296                metalPrice = 1 / theData.rates.XPT;
297                break;
298            case 'palladium':
299                metalPrice = 1 / theData.rates.XPD;
300                break;
301            case 'rhodium':
302                metalPrice = 1 / theData.rates.XRH;
303                break;
304            case 'copper':
305                metalPrice = 1 / theData.rates.XCU;
306                break;
307            case 'aluminum':
308                metalPrice = 1 / theData.rates.ALU;
309                break;
310            default:
311                metalPrice = '';
312                break;
313        }
314
315        ouncePrice.forEach(item => {
316            item.innerHTML = `$${metalPrice.toLocaleString(undefined, {
317                minimumFractionDigits: 2,
318                maximumFractionDigits: 2
319            })}`
320        })
321
322        gramPrice.forEach(item => {
323            let metalPriceGram = metalPrice / 28.3495;
324            item.innerHTML = `$${metalPriceGram.toLocaleString(undefined, {
325                minimumFractionDigits: 2,
326                maximumFractionDigits: 2
327            })}`
328        })
329    }
330
331    const fetchGoldSilverPrices = async (metal, ouncePrice, gramPrice, data, goldPriceOunce24k, goldPriceOunce22k, 
332        goldPriceOunce18k, goldPriceOunce14k, goldPriceOunce9k, troyOuncePrice) => {
333        const jsonData = await data;
334        const amValue = jsonData.rates.LBXAUAM;
335        const pmValue = jsonData.rates.LBXAUPM;
336        const silverValue = jsonData.rates.LBXAG;
337        let latestValue;
338        if (metal == 'gold') {
339            latestValue = amValue || pmValue;
340        } else {
341            latestValue = silverValue;
342        }
343        let latestPrice = 1 / latestValue;
344        var latestOuncePrice = latestPrice;
345
346        if(troyOuncePrice) troyOuncePrice.innerHTML = latestPrice.toLocaleString(undefined, { 
347            minimumFractionDigits: 2, maximumFractionDigits: 2
348        });
349
350        if(goldPriceOunce24k) goldPriceOunce24k.innerHTML = (latestPrice * 0.999).toLocaleString(undefined, { 
351            minimumFractionDigits: 2, maximumFractionDigits: 2
352        });
353
354        if(goldPriceOunce22k) goldPriceOunce22k.innerHTML = (latestPrice * 0.99).toLocaleString(undefined, {
355            minimumFractionDigits: 2, maximumFractionDigits: 2
356        });
357
358        if(goldPriceOunce18k) goldPriceOunce18k.innerHTML = (latestPrice * 0.75).toLocaleString(undefined, {
359            minimumFractionDigits: 2, maximumFractionDigits: 2
360        });
361
362        if(goldPriceOunce14k) goldPriceOunce14k.innerHTML = (latestPrice * 0.583).toLocaleString(undefined, {
363            minimumFractionDigits: 2, maximumFractionDigits: 2
364        });
365        
366        if(goldPriceOunce9k) goldPriceOunce9k.innerHTML = (latestPrice * 0.375).toLocaleString(undefined, {
367            minimumFractionDigits: 2, maximumFractionDigits: 2
368        });
369        
370        ouncePrice.each(function() {
371            ouncePrice.html(latestOuncePrice.toLocaleString(undefined, {
372                minimumFractionDigits: 2, maximumFractionDigits: 2
373            }));
374        });
375
376        //Calculate price per gram
377        var value = 0.03527396 * latestPrice;
378        value = value.toLocaleString(undefined, {
379            minimumFractionDigits: 2, maximumFractionDigits: 2
380        });
381        gramPrice.each(function() {
382            gramPrice.html(value);
383        });
384    }
385
386    if(priceOuncePlatinum.length > 0 || priceGramPlatinum.length > 0) {
387        setMetalPrices('platinum', priceOuncePlatinum, priceGramPlatinum, metalsData);
388    }
389    if( priceOuncePalladium.length > 0 || priceGramPalladium.length > 0 ) {
390        setMetalPrices('palladium', priceOuncePalladium, priceGramPalladium, metalsData);
391    }
392    if( priceOunceRhodium.length > 0 || priceGramRhodium.length > 0 ) {
393        setMetalPrices('rhodium', priceOunceRhodium, priceGramRhodium, metalsData);
394    }
395    if( priceOunceCopper.length > 0 || priceGramCopper.length > 0 ) {
396        setMetalPrices('copper', priceOunceCopper, priceGramCopper, metalsData);
397    }
398    if( priceOunceAluminum.length > 0 || priceGramAluminum.length > 0 ) {
399        setMetalPrices('aluminum', priceOunceAluminum, priceGramAluminum, metalsData);
400    }
401    if( priceOunceSilver.length > 0 || priceGramSilver.length > 0 ) {
402        fetchGoldSilverPrices('silver', priceOunceSilver, priceGramSilver, metalsData);
403    }
404    if( priceOunceGold.length > 0 || priceGramGold.length > 0 ) {
405        fetchGoldSilverPrices('gold', priceOunceGold, priceGramGold, metalsData, goldPriceOunce24k, goldPriceOunce22k, goldPriceOunce18k, goldPriceOunce14k, goldPriceOunce9k, troyOuncePrice);
406    
407    }
408    
409
410    const checkCategoryName = (i, categoryName) => {
411        if(subMenuHeadings[i]?.innerHTML.search(categoryName) >= 0 && subMenuHeadings[i]?.innerHTML.search('ancestor-wrapper') < 0) {
412            let newValue = subMenuHeadings[i].children[0].innerHTML.replace(categoryName,`<span class="color-pink"> ${categoryName} </span>`);
413            subMenuHeadings[i].children[0].innerHTML = newValue;
414        }
415    }
416
417    let subMenuHeadings = document.querySelectorAll('.main-megamenu-heading');
418    if(subMenuHeadings) {
419        for(let i = 0; i <= subMenuHeadings.length; i++) {
420            checkCategoryName(i, 'money');
421            checkCategoryName(i, 'Money');
422            checkCategoryName(i, 'self care');
423            checkCategoryName(i, 'self-care');
424            checkCategoryName(i, 'Self-Care');
425            checkCategoryName(i, 'Self Care');
426            checkCategoryName(i, 'divorce');
427            checkCategoryName(i, 'Divorce');
428            checkCategoryName(i, 'dating');
429            checkCategoryName(i, 'Dating');
430            checkCategoryName(i, 'parenting');
431            checkCategoryName(i, 'Parenting');
432        }
433    }
434}, false);
435
436// Change the Url when selecting a state from dropdown
437let currentUrl = window.location.href;
438let statesArray = [];
439let dropdownStates = document.getElementById("the-dropdown-states");
440let blogNavigationButtons = document.querySelector(".pagination-single-inner");
441for (i = 0; i < dropdownStates.options.length; i++) {
442    statesArray[i] = dropdownStates.options[i].value;
443}
444statesArray.map((state) => {
445    if(currentUrl.search(state) >= 0) {
446        blogNavigationButtons.style.display = 'none';
447    }
448})
449
450dropdownStates.onchange = function () {
451    let mainPost = 1;
452    newState = dropdownStates.options[dropdownStates.selectedIndex].value;
453    let stringToReplace = '';
454    statesArray.forEach((state) => {
455        if (currentUrl.search(state) >= 0) {
456            stringToReplace = stringToReplace.length < state.length?  state : stringToReplace;
457            mainPost = 0;
458        }
459    });
460
461    if(mainPost === 1) {
462        let newStateUrl = currentUrl.replace(/\/(?=[^\/]*$)/, `-${newState}`);
463        window.location.replace(newStateUrl);
464    } else {
465        let newStateUrl = currentUrl.replace(stringToReplace, newState);
466        window.location.replace(newStateUrl);
467    }
468};
469const selectedValue = window.location.pathname.replace('/', '').replace('/', '')
470let opts = dropdownStates.options.length;
471let selectedIndex = null;
472for (let i=0; i<opts; i++){
473    let currentValue = dropdownStates.options[i].value;
474    if (selectedValue.includes(currentValue)){
475        if (!selectedIndex || dropdownStates.options[selectedIndex].value.length < currentValue.length) {
476            selectedIndex = i;
477        }
478    }
479}
480dropdownStates.options[selectedIndex ].selected = true;
481
482dropdownStates.addEventListener("click", function(){
483    dropdownStates.classList.add("opened-dropdown");
484});
485
486let companyEmailElement = document.querySelector('.tag-social-icons');
487let afterTelephoneElement = document.querySelectorAll('.archive-title > span.author');
488if (companyEmailElement && afterTelephoneElement) {
489    afterTelephoneElement.parentNode.insertBefore(companyEmailElement, afterTelephoneElement.nextSibling);
490}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.