Last active
January 22, 2018 04:01
-
-
Save jackm/089416ebccb422b4a3d5 to your computer and use it in GitHub Desktop.
Revisions
-
jackm revised this gist
Jan 22, 2018 . 1 changed file with 18 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,32 +1,31 @@ // ==UserScript== // @name Kijiji show category ID // @namespace KijijiScripts // @version 0.5 // @description Add an indicator to show decoded location IDs and category IDs in the breadcrumb nav list (not normally visible) // @match https://www.kijiji.ca/* // @grant none // ==/UserScript== (function() { if (document.querySelector('div[class^="breadcrumbs-"]')) { var breadcrumUrls = document.querySelectorAll('a[class^="crumbLink-"]'); for (var i = 0; i < breadcrumUrls.length; i++) { var s = document.createElement("strong"); // Extract out the 'ID' section from the url which is the part after the right most slash var id = breadcrumUrls[i].href.split('/')[breadcrumUrls[i].href.split('/').length - 1]; // Check if ID string contains an 'l' char or not // if it does it must be a category ID and if not it must be a location ID if (id.indexOf('l') >= 0) { // eg. id could be 'c128l1700212' where the integer between the 'c' and 'l' chars is the category ID s.innerHTML = " (CatId " + id.split('c').pop().split('l').shift() + ")"; } else { s.innerHTML = " (LocId " + id + ")"; } breadcrumUrls[i].parentNode.appendChild(s); } } })(); -
jackm revised this gist
Jan 22, 2018 . 1 changed file with 16 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,32 @@ // ==UserScript== // @name Kijiji show category ID // @namespace KijijiScripts // @version 0.4 // @description Add an indicator to show decoded location IDs and category IDs in the breadcrumb nav list (not normally visible) // @match http://www.kijiji.ca/* // @match https://www.kijiji.ca/* // @grant none // ==/UserScript== (function() { if (document.querySelector("div.breadcrumb")) { var locUrls = document.querySelectorAll(".location-selected[itemprop=url]"); for (var i = 0; i < locUrls.length; i++) { var s = document.createElement("strong"); var id = locUrls[i].href.split("/")[locUrls[i].href.split("/").length - 1]; s.innerHTML = "(LocId " + id + ")"; locUrls[i].parentNode.appendChild(s); } var catUrls = document.querySelectorAll(".category-selected[itemprop=url]"); for (var i = 0; i < catUrls.length; i++) { var s = document.createElement("strong"); s.innerHTML = "(CatId " + catUrls[i].getAttribute('data-id') + ")"; catUrls[i].parentNode.appendChild(s); } if (Kj.extVars.tracking.catId) { var s = document.createElement("strong"); s.innerHTML = " (CatId " + Kj.extVars.tracking.catId + ")"; document.querySelector("div.breadcrumb").lastElementChild.appendChild(s); } } })(); -
jackm revised this gist
Jun 13, 2016 . 1 changed file with 16 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,25 @@ // ==UserScript== // @name Kijiji show category ID // @namespace KijijiScripts // @version 0.3 // @description Add an indicator to show decoded category IDs in the breadcrumb nav list (not normally visible) // @match http://www.kijiji.ca/* // @match https://www.kijiji.ca/* // @grant none // ==/UserScript== (function() { if (document.querySelector('div.breadcrumb')) { var catUrls = document.querySelectorAll('.category-selected[itemprop=url]'); for (var i = 0; i < catUrls.length; i++) { var s = document.createElement('strong'); s.innerHTML = "(Cat ID " + catUrls[i].getAttribute('data-id') + ")"; catUrls[i].parentNode.appendChild(s); } if (Kj.extVars.tracking.catId) { var s = document.createElement('strong'); s.innerHTML = " (Cat ID " + Kj.extVars.tracking.catId + ")"; document.querySelector('div.breadcrumb').lastElementChild.appendChild(s); } } })(); -
jackm revised this gist
Nov 6, 2015 . No changes.There are no files selected for viewing
-
jackm revised this gist
Nov 6, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name Kijiji show category ID // @namespace ? // @version 0.2 // @description Add an indicator to show decoded category IDs in the breadcrumb nav list (not normally visible) // @match http://www.kijiji.ca/* // @match https://www.kijiji.ca/* @@ -17,7 +17,7 @@ if (document.querySelector('div.breadcrumb')) { catUrls[i].parentNode.appendChild(s); } if (Kj.extVars.tracking.catId) { var s = document.createElement('strong'); s.innerHTML = " (Cat ID " + Kj.extVars.tracking.catId + ")"; -
jackm created this gist
Nov 6, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // ==UserScript== // @name Kijiji show category ID // @namespace ? // @version 0.1 // @description Add an indicator to show decoded category IDs in the breadcrumb nav list (not normally visible) // @match http://www.kijiji.ca/* // @match https://www.kijiji.ca/* // @grant none // ==/UserScript== if (document.querySelector('div.breadcrumb')) { var catUrls = document.querySelectorAll('.category-selected[itemprop=url]'); for (var i = 0; i < catUrls.length; i++) { var s = document.createElement('strong'); s.innerHTML = "(Cat ID " + catUrls[i].getAttribute('data-id') + ")"; catUrls[i].parentNode.appendChild(s); } if (Kj.extVars) { var s = document.createElement('strong'); s.innerHTML = " (Cat ID " + Kj.extVars.tracking.catId + ")"; document.querySelector('div.breadcrumb').lastElementChild.appendChild(s); } }