Last active
March 26, 2018 18:02
-
-
Save tidusx18/ef2a6a7fe10941a12c9ff5dd2e09a092 to your computer and use it in GitHub Desktop.
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 characters
// ==UserScript== | |
// @name Highlight Link Reference Issue | |
// @match https://fiu.instructure.com/* | |
// @exclude https://fiu.instructure.com/courses/*/link_validator | |
// @exclude https://fiu.instructure.com/courses | |
// @exclude https://fiu.instructure.com/courses/*/content_migrations | |
// ==/UserScript== | |
let blackboardLinks = document.querySelectorAll('#content_listContainer a'); | |
let canvasLinks = document.querySelectorAll('#content a'); | |
let items = []; | |
let linkFlag = 'xid-'; | |
let canvasCourseID = document.location.href.match(/\/(\d{4})\//i)[1]; | |
for (let l of blackboardLinks) { | |
if (l.href.includes(linkFlag)) { | |
items.push(l.innerText); | |
l.setAttribute('style', 'border: #FF0000 4px solid;'); | |
} | |
} | |
if (items.length > 0) { | |
// alert (`There are ${items.length} old link(s) on this page highlighted in red.`); | |
// List out items in console | |
console.log(items); | |
} | |
for (let l of canvasLinks) { | |
if ( l.href.includes(linkFlag) || ( l.href.includes('fiu.instructure.com/courses/') && !l.href.includes(canvasCourseID) ) ) { | |
items.push(l.innerText); | |
l.setAttribute('style', 'border: #FF0000 4px solid;'); | |
} | |
} | |
if (items.length > 0) { | |
// alert (`There are ${items.length} old link(s) on this page highlighted in red.`); | |
// List out items in console | |
console.log(items); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment