MCPcopy Create free account
hub / github.com/Milkyroad/SCiPNET / getFrame

Function getFrame

public/src/js/access.js:401–465  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

399}
400
401function getFrame() {
402 $d.find(`#${accessListing}-list iframe`).each(function() {
403 if ($(this).css("display") == "none" || $(this).contents().prevObject[0].name) {
404 $(this).remove()
405 } else {
406 var $s = $(this)
407 var source = new URL($s.attr("class"), "https://scp-wiki.wdfiles.com/")
408 $.ajax({
409 url: `${link}${source.toString()}`,
410 type: 'GET',
411 success: function(data) {
412 var domain = source.origin
413 var availability = true;
414 if (link == "https://api.allorigins.win/get?url=") {
415 data = data.contents
416 }
417 var $c = cheerio.load(data.replace(`window.open("//`, `window.open("http://`).replace(`window.open('//`, `window.open('http://`).replace(`window.open("/`, `window.open("${domain}/`).replace(`window.open('/`, `window.open('${domain}/`), {
418 decodeEntities: false
419 });
420 $c('[onclick]').each(function() {
421 $c(this).attr("onclick", $c(this).attr("onclick").replace(/"/g, "'"))
422 })
423 $c("link").each(function() {
424 var link = $c(this).attr("href")
425 if (link != undefined) {
426 $c(this).attr("href", new URL(link, domain).toString())
427 }
428 });
429 $c("a").each(function() {
430 var link = $c(this).attr("href")
431 if (link != undefined) {
432 $c(this).attr("href", new URL(link, domain).toString())
433 }
434 if ($c(this).attr("href") != undefined && checkForAva($c(this).attr("href"))) {
435 $c(this).replaceWith(`<ele-access data-link="${$c(this).attr("href")}">${$c(this).html()}</ele-access>`)
436 }
437 });
438 $c("img, audio, script, source").each(function() {
439 var link = $c(this).attr("src")
440 if (link != undefined) {
441 $c(this).attr("src", new URL(link, domain).toString())
442 }
443 });
444 $c('*[src^="http://scp-wiki.wdfiles.com/"]').each(function() {
445 $c(this).attr("src", $c(this).attr("src").replace(/^http:\/\//i, 'https://'))
446 });
447 $c('*[src^="https://www.scp-wiki.net/"]').each(function() {
448 var newUrl = `https://scp-wiki.wdfiles.com/local--files/${$c(this).attr("src").split('https://www.scp-wiki.net/local--files/')[1]}`;
449 $c(this).attr("src", newUrl)
450 });
451 $c("head").append(`<script src="/src/ex_file/scripts/jquery-3.6.0.min.js"></script><link type="text/css" rel="stylesheet" href="/src/css/innerIframe.min.css" />`)
452 var frameSrc = $c.html();
453 if (isTrad) {
454 frameSrc = he.decode(opencc.simplifiedToHongKong(frameSrc))
455 }
456
457 $s.attr("srcdoc", he.decode(frameSrc));
458 $s.attr("class", "");

Callers 1

checkBarLoadedFunction · 0.85

Calls 3

checkForAvaFunction · 0.85
removeMethod · 0.80
$Function · 0.50

Tested by

no test coverage detected