This file contains 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
#All the hrefs are extracted from all the anchor links on the page and stored in the array 'anchorHrefs' | |
anchorHrefs = anchor.href for anchor in $("a") |
This file contains 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
#Check whether the current web is the root web and if its not, append a "/" to the end. | |
currentUrl = _spPageContextInfo.webServerRelativeUrl | |
currentFormattedUrl = if currentUrl is "/" then currentUrl else currentUrl + "/" | |
alert currentFormattedUrl |
This file contains 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
#Call the loadCOM function only if the sp.js script is loaded on this page. | |
ExecuteOrDelayUntilScriptLoaded loadCOM, "sp.js" |
This file contains 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
var PrintName = function (firstname,lastname) { | |
///<signature> | |
///<summary>Print the First Name</summary> | |
///<param name="name" type="String">First Name</param> | |
///<returns type="void"/> | |
///</signature> | |
///<signature> | |
///<summary>Print the Full Name</summary> | |
///<param name="name" type="String">First Name</param> | |
///<param name="lastname" type="String">Last Name</param> |
This file contains 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
var ModuleToTest = function () { | |
return { | |
//Function to Convert a value to Integer with radix 10. | |
MakeInt: function (value) { | |
return parseInt(value, 10); | |
}, | |
//Function to multiply two numbers and return the product. |
This file contains 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
//The "describe" function is used to define the functionality which will be tested for the function. | |
//It takes 2 parameters: The first is the name of the function and next is an anonymous function which will contain the testing code. | |
describe("Test Module", function () { | |
//One describe function can be nested inside another. This is particularly great if you want to test modules which have nested functions. | |
describe("MakeInt", function () { | |
//The it function describes one implementation of a function. The syntax is same as describe: first parameter is the description of the implementation and | |
//the second is an anonymous function which will be used to execute the function to test. | |
it("Makes strings into integers", function () { |
This file contains 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Jasmine Spec Runner</title> | |
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0/jasmine_favicon.png"/> | |
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.1.0/jasmine.css"/> | |
This file contains 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
public static void SandboxRegisterClientScriptBlock(string scriptId, string scriptUrl,Page page) | |
{ | |
//Add script control. | |
HtmlGenericControl addJscript = new HtmlGenericControl("script"); | |
addJscript.Attributes.Add("type", "text/javascript"); | |
//Checks if the script is already loaded and if not, load it. | |
addJscript.InnerHtml = @"function CheckScriptAndLoad() { | |
//Check if script is loaded. Return true if yes, else return false. | |
var isScriptLoaded = function (scriptId) { | |
if (document.getElementById(scriptId) != null) { |
This file contains 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
var listItems; // The list of retrieved items. | |
var query; // For paging, reuse the same query object. | |
var targetList; // The list from which to retrieve items. | |
var clientContext; | |
function runCode() { | |
clientContext = new SP.ClientContext(); | |
targetList = clientContext.get_web().get_lists().getByTitle('Announcements'); | |
query = new SP.CamlQuery(); | |
//Specifying the RowLimit will determine how many items will be fetched in one call to the server. |
This file contains 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
<xsl:output method="xml" indent="no" encoding="iso-8859-1"/> |