sharepoint cdn js template
/* | |
* Anatoly Mironov http://sharepointkunskap.wordpress.com, http://www.bool.se | |
* Use this script to add your js files to your page in the console dynamically | |
* Don't use it in the production, just for testing | |
*/ | |
function addScript(url) { | |
var script = document.createElement("script"); | |
script.setAttribute("type","text/javascript"); | |
script.setAttribute(src, url); | |
document.body.appendChild(script); | |
} | |
function addStyle(url) { | |
var link = document.createElement("link") | |
link.setAttribute("rel", "stylesheet") | |
link.setAttribute("type", "text/css") | |
link.setAttribute("href", url) | |
} | |
addScript("//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"); | |
addScript("//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"); | |
addScript("//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.2/jquery.SPServices-0.7.2.min.js"); | |
addStyle("//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/start/jquery-ui.css"); |
<!-- | |
Add this to the webpart | |
See my blog post | |
http://sharepointkunskap.wordpress.com/2012/05/13/javascript-toolkit-on-text-file/ | |
Inspiration got from sympmarc | |
http://sympmarc.com/2012/04/20/referencing-jquery-jqueryui-and-spservices-from-cdns/ | |
and Thorsten Hans: | |
https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/SharePoint-Development-Using-HeadJS-KnockoutJS-And-SPServices.aspx | |
--> | |
<!-- Reference the jQueryUI theme's stylesheet on the Google CDN. Here we're using the "Start" theme --> | |
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/start/jquery-ui.css" /> | |
<!-- Reference head.js on cdnjs (Cloudflare)--> | |
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/headjs/0.96/head.min.js"></script> | |
<!-- Load all other scripts async and run sync: --> | |
<script type="text/javascript"> | |
head.js("//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", | |
"//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js", | |
"//ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js", | |
"//cdnjs.cloudflare.com/ajax/libs/knockout/2.0.0/knockout-min.js", | |
"//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js", | |
"my.js" ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment