PageSourceSearch

https://www.dentalspecialityclinic.com/themes/website/assets/clien…?v.1b0d1b-b14478af8aff84b7e33497bb6c1c0bcf

js dentalspecialityclinic.com collected 2026-10-04 20:58:13 UTC 5,977 bytes, 139 lines download raw bytes

1$(document).ready(function(){
2    var pagesToGet = []; //Array that will hold the page ajax requests
3    var blogDictionary = {}; //A dictionary object that will hold every blog title / url pair.
4    var blogTitles = []; //An array that holds every blog title to look up in the dictionary.
5    var lastPageInt; //an int to hold how many pages need to be processed
6    var results = []; //Array that will hold the results from the AJAX GET requests
7    var domain = window.location.href.split('/'); //grabs the current domain
8    var absolutePath = domain[0] + '//' + domain[2] + '/' + domain[3] + '/'; //The absolute path that will be put in front of all blog page urls for the redirect
9    
10    //Checks to make sure this is the blog page
11    if($('.blog').length){
12
13        //Checks to see if a "Last" button exists
14        if($('.blog__pagination-item--last').length){
15
16            //if one does, grabs the page and gets the number from it to know how many pages need to be pulled
17            var lastPage = $('.blog__pagination-item--last > a').attr('href');
18            var array = lastPage.split('/');
19            lastPage = array[array.length - 1];
20            lastPageInt = parseInt(lastPage, 10);
21        }
22
23        //if there isn't a "Last" button, checks to see if there is a button for another page
24        else if($('.blog__pagination-item').length){
25
26            //if there is, gets the item, finds the last link in the list, goes back one (the real last button is the "next" button), and gets its href
27            var lastPage = $('.blog__pagination-item').last().prev().find('a').attr('href');
28            
29            //then gets the number of the page so we know how many pages to process
30            var array = lastPage.split('/');
31            lastPage = array[array.length - 1];
32            lastPageInt = parseInt(lastPage, 10);
33
34        //If there are no buttons at all, just sets the amount of pages to 1
35        } else {
36            lastPageInt = 1;
37        }
38
39        //Loops through every page starting at 1
40        for( var i = 1; i <= lastPageInt; i++){
41
42            //makes the link
43            var url = absolutePath + "blog/page/" + i;
44
45            //And does an AJAX GET request, storing the request in pagesToGet, and storing the data in the results array
46            pagesToGet.push($.get(url, function(data){results.push(data);}));
47        }
48
49        //When all requests have received responses
50        $.when.apply($, pagesToGet).then(function(){
51
52            //loops through each result
53            for(result in results){
54
55                //and gets the redirect
56                getBlogLinks(results[result]);
57            }
58            
59            //Once all redirects have been set up, outputs the result to console
60            displayCSV();
61        });
62    }
63    
64    /*
65    Function to get the page title / url pair and add them to the blogDictionary and blogTitles array.
66    data: String from AJAX GET request
67    No Return, modifies blogDictionary and blogTitles global variables
68    */
69    function getBlogLinks(data) {
70
71        //processes each title on the page
72        $(data).find('.blog__post-title').each(function(){
73            var title = $(this).text(); //Gets the title
74            var url = $(this).attr('href'); //gets the url from the href
75            title = escapeQuotes(title); //Replaces " with \" to prevent issues when displaying
76            blogDictionary[title] = url; //Adds the url to the dictionary with the title as the key
77            blogTitles.push(title); //adds the title to the array
78        });
79    }
80
81    /*
82    Function to create the csv file text and output it to console
83    No input, utalizes global variables
84    No return
85    */
86    function displayCSV(){
87        var outputText = ''; //initalizes the output
88        //goes through each title
89        for(title in blogTitles){
90
91            //gets the new link from the blogDictionary and makes it relative
92            var newLink = makeLinkRelative(blogDictionary[blogTitles[title]]);
93
94            var oldLink = convertOldLink(blogTitles[title]); //creates the old link based on the title
95            outputText += oldLink + ',' + newLink + ',' + '301,exact\n'; //adds the csv for the title/url pair to the output text variable
96        }
97        console.log(outputText); //Outputs the result to console
98    }
99    
100
101    /*
102    Helper function to make a link relative for the csv
103    link: A string that is a absolute linked url
104    Return: A string of the url linked relatively
105    */
106    function makeLinkRelative(link){
107        var splitArray = link.split('/blog/'); //splits the link using /blog/
108        return "/blog/" + splitArray[splitArray.length - 1]; //adds back the /blog/ and only adds back the second half, thus making the link relative
109    }
110
111    /*
112    Takes a title and converts it into what the url for on the old editor would be.
113    currentTitle: A string of the title to be converted
114    Return: A string of the converted url
115    */
116    function convertOldLink(currentTitle){
117        
118        //takes the title, replaces all white spaces with a -, then converts to lowercase
119        currentTitle = currentTitle.replace(/\s+/g, '-').toLowerCase();
120    
121        //replaces all underscores _ with a -
122        currentTitle = currentTitle.replace("_", "-");
123    
124        //removes all non alphanumerical characters but keeps dashes in place
125        currentTitle = currentTitle.replace(/[^A-Za-z0-9-]/g,'');
126    
127        //outputs what the old link would have been based on the title given
128        return "/blog/post/" + currentTitle + ".html";
129    }
130
131    /*
132    Takes in a string and adds \ in front of every quote to prevent possible issues
133    title: String to be processed
134    return: string
135    */
136    function escapeQuotes(title) {
137        return title.split('"').join('\"');
138    }
139});

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.