PageRenderTime 24ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/index.html

https://github.com/sdslabs/cdnjs-website
HTML | 391 lines | 311 code | 75 blank | 5 comment | 0 complexity | 67b89b20ae664d6d7798ea3d0d9da72a MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>cdn js - the missing cdn</title>
  6. <!--[if lt IE 9]>
  7. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  8. <![endif]-->
  9. <link rel="stylesheet" media="all" href="style.css"/>
  10. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  11. <link rel="icon" href="favicon.ico" type="image/x-icon">
  12. <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
  13. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  14. <!-- Adding "maximum-scale=1" fixes the Mobile Safari auto-zoom bug: http://filamentgroup.com/examples/iosScaleBug/ -->
  15. <script src="https://cdn.sdslabs.co.in/cdnjs/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
  16. <script src="http://cdn.sdslabs.co.in/cdnjs/ajax/libs/underscore.js/1.1.4/underscore-min.js"></script>
  17. <script src="http://cdn.sdslabs.co.in/cdnjs/ajax/libs/backbone.js/0.3.3/backbone-min.js"></script>
  18. <script src="http://cdn.sdslabs.co.in/cdnjs/ajax/libs/waypoints/1.0.2/waypoints.min.js"></script>
  19. <script type="text/javascript">
  20. $(document).ready( function(){
  21. Package = Backbone.Model.extend({
  22. });
  23. Packages = Backbone.Collection.extend({
  24. model: Package
  25. });
  26. SiteController = Backbone.Controller.extend({
  27. routes: {
  28. "/search/author/:author": "authorsearch",
  29. "/search/:term": "namesearch",
  30. "/search/tag/:tag": "tagsearch",
  31. "/page/:page": "defaultRoute",
  32. },
  33. defaultRoute: function( page ){
  34. var $this = $(this);
  35. target = page;
  36. $target = $("#"+target);
  37. $('html, body').stop().animate({
  38. 'scrollTop': $target.offset().top - 120
  39. }, 500, 'swing', function() {
  40. if( location.hash == "#/page/search" ) {
  41. $("#searchinput").focus();
  42. }
  43. });
  44. },
  45. tagsearch: function( tag ){
  46. $("#searchinput").val("#" + tag);
  47. this.appview.searchPackages();
  48. $('#searchinput').focus();
  49. },
  50. authorsearch: function( author ){
  51. $("#searchinput").val("@" + author);
  52. this.appview.searchPackages();
  53. },
  54. namesearch: function( term ){
  55. $("#searchinput").val( term );
  56. this.appview.searchPackages();
  57. }
  58. });
  59. packages = new Packages;
  60. AppView = Backbone.View.extend({
  61. el: $("#container"),
  62. initialize: function(){
  63. $("#search_form_container").append( _.template( $("#search_form_template").html(), {} ) );
  64. $("#searchinput").focus();
  65. controller = new SiteController;
  66. controller.appview = this;
  67. Backbone.history.start();
  68. if( $("#searchinput").val() == "" ){
  69. popular = _.select( packages.models, function( result ) {
  70. if( _.any( result.get("keywords"), function(tagname){ if( tagname.indexOf("popular") != -1 ) return true; } ) ){
  71. return result;
  72. }
  73. })
  74. $("#search_results").html( "POPULAR" + _.template( $("#search_results_template").html(), { results: popular } ) );
  75. }
  76. },
  77. events: {
  78. "keyup #searchinput": "searchPackages",
  79. },
  80. searchPackages: function(e){
  81. if( typeof e != "undefined" ){
  82. if ( _.any( [37,38,39,40,33,18,34] , function (key){ if( key == e.keyCode ) return true; } ) ) return;
  83. }
  84. // if (e.keyC
  85. $('html, body').stop().animate({
  86. 'scrollTop': "0"
  87. }, 500, 'swing', function() {
  88. // window.location.hash = target
  89. });
  90. var search = $("#searchinput").val();
  91. window.location = "#/search/" + search;
  92. searches = search.split(" ");
  93. searches = _.select( searches, function( search ) { if( search ) return true; } );
  94. results = packages.models;
  95. for( i = 0; i < searches.length; i ++) {
  96. search = searches[i];
  97. results = _.select( results, function(jspackage){
  98. packagename = jspackage.get("name");
  99. tags = jspackage.get("keywords");
  100. authors = jspackage.get("maintainers");
  101. if( typeof packagename != "undefined" ){
  102. if( search.indexOf("@") != -1){
  103. author = search.split("@");
  104. author = author[1];
  105. if( author != "" ){
  106. if( _.any( authors, function(authorname){ if( authorname.name.replace(/ /g, "").toLowerCase().indexOf(author.toLowerCase()) != -1 ) return true; } ) ){
  107. return jspackage;
  108. }
  109. }
  110. } else if( search.indexOf("#") != -1){
  111. tag = search.split("#");
  112. tag = tag[1];
  113. if( tag != "" ){
  114. if( tag == "all" || _.any( tags, function(tagname){ if( tagname.indexOf(tag) != -1 ) return true; } ) ){
  115. return jspackage;
  116. }
  117. }
  118. } else if(packagename.toLowerCase().indexOf(searches[i].toLowerCase()) != -1 ) {
  119. return jspackage;
  120. }
  121. }
  122. return false;
  123. });
  124. }
  125. if( results.length > 0 && searches.length != 0) {
  126. $("#search_results").html( _.template( $("#search_results_template").html(), { results: results } ) );
  127. } else {
  128. $("#search_results").html( "No results found, you can use tags @author and #tag");
  129. }
  130. }
  131. })
  132. var appview = {};
  133. $(function() {
  134. $("#search_results").html('Loading ...');
  135. $.getJSON('/help/packages.json', function(data) {
  136. packages.refresh(data.packages);
  137. appview = new AppView;
  138. });
  139. })
  140. $(".cdnlink").live("click", function(){
  141. $(this).select();
  142. });
  143. // Smooth scrolling for internal links
  144. smoothscroll = function(event) {
  145. var $this = $(this);
  146. targetold = this
  147. target = this.hash.replace("/page/","");
  148. $target = $(target);
  149. //alert($target.offset().top)
  150. $('html, body').stop().animate({
  151. 'scrollTop': $target.offset().top - 120
  152. }, 500, 'swing', function() {
  153. if( window.location.hash == "#/page/search" ) {
  154. $("#searchinput").focus();
  155. }
  156. window.location.hash = targetold.hash
  157. });
  158. event.preventDefault();
  159. return false;
  160. }
  161. $("#searchinput").live("click", function(){
  162. appview.searchPackages();
  163. });
  164. $("a[href^='#/page']").click(smoothscroll);
  165. $('.waypoint').each( function(){
  166. $(this).waypoint( function( event, direction ) {
  167. var $active = $(this);
  168. if (direction === "up") {
  169. $active = $active.prev();
  170. }
  171. if (!$active.length) $active.end();
  172. $(".active").removeClass("active");
  173. $('a[waypoint='+$active.attr("id")+']').addClass('active');
  174. },{
  175. "offset": "50%"
  176. });
  177. });
  178. });
  179. </script>
  180. </head>
  181. <body lang="en">
  182. <div id="container">
  183. <div id="header" style="top: 0;position: fixed; left: 50%; width:940px;margin-left: -460px;border: 1px solid #ccc; border-top: none;background: #ebebeb;">
  184. <div style="float: left;">
  185. <h1 style="font-size: 3em; font-family: Ubuntu;margin-left: 20px; margin-bottom: 0px">cdnjs.com</h1>
  186. <h2 style="padding: 0; margin: 0; margin-top: -28px; font-size: 16px; margin-bottom: 0px; margin-left: 122px;" >the missing cdn</h2>
  187. <ul class="menu" style="margin-left: 40px; margin-top: -10px; margin-bottom: 5px;">
  188. <li><a waypoint="search" class="active" href="#/page/search">search</a></li>
  189. <li><a waypoint="addlibrary" href="#/page/addlibrary">add a library</a></li>
  190. <li><a waypoint="sponsors" href="#/page/sponsors">sponsors</a></li>
  191. <li><a waypoint="about" href="#/page/about">about</a></li>
  192. </ul>
  193. </div>
  194. <div id="search_form_container"></div>
  195. </div> <!-- jeader -->
  196. <div id="search" class="waypoint">
  197. <div class="column">
  198. <div class="column_container">
  199. <p style="text-align: center;"><strong>Update:<a target="_blank" href="https://github.com/sdslabs/cdncss" style="text-decoration: none;"></strong> cdn<strong>css</strong>.com</a> is under-way!</p>
  200. <h2 style=" text-align: center; padding:0;font-size: 24px;">What is it?</h2>
  201. <p style="font-size: 14px; margin-left: 20px;margin-top: 15px; margin-bottom: 15px; width: 90%">
  202. Everyone loves the <a target="_blank" href="http://code.google.com/apis/libraries/devguide.html">Google CDN</a> right? Even <a href="http://www.asp.net/ajaxlibrary/cdn.ashx" target="_blank">Microsoft runs their own CDN</a>.<br /><br />The problem is, they only host the most popular libraries.
  203. <br /><br />
  204. We host the other stuff.</p>
  205. <br />
  206. <span style="margin-left: 8px;"><a href="http://cloudflare.com"><img src="/images/poweredbycloudflare.png" /></a></span>
  207. <br />
  208. <br />
  209. <span style="margin-top: 6px; margin-left: 80px;" class="st_twitter_vcount" displayText="Tweet"></span><span class="st_facebook_vcount" displayText="Share"></span><span class="st_email_vcount" displayText="Email"></span><span class="st_sharethis_vcount" displayText="Share"></span><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher:'bdee6d8c-ed9a-4867-90f6-011704c29ee3'});</script>
  210. <br />
  211. <br />
  212. <p style="text-align: center; font-size: 12px;">*https support is enabled</p>
  213. </div> <!-- info column container -->
  214. </div>
  215. <div class="column">
  216. <div class="column_container">
  217. <div id="search_results">
  218. </div>
  219. </div>
  220. </div>
  221. </div> <!-- searc -->
  222. <div id="addlibrary" class="waypoint info">
  223. <div class="column"><div class="column_container"><h1>add a library</h1>
  224. <p style="font-size: 14px;">
  225. Our goal is to operate this CDN in a peer reviewed fashion. <br /><br />This means only the highest quality libraries vetted by the community get added to cdnjs.com<br />
  226. <br />All CDNJS code is open source and we welcome users fork request to help maintain an up-to-date collection of Javascript libraries.</p>
  227. </p>
  228. <div class="ribbon">
  229. <a href="https://github.com/cdnjs/cdnjs" rel="me">Fork cdnjs.com</a>
  230. </div>
  231. </div></div>
  232. <div class="column"><div class="column_container"> <iframe id="uservoice_dialog_iframe" src="http://cdnjs.uservoice.com/forums/98277/widgets/popin.html?lang=en&amp;referer=http://www.cdnjs.com/" frameborder="0" scrolling="no" allowtransparency="true" style="overflow:hidden; width:390px margin: auto; height: 360px; margin-left: 30px;" width="350px"></iframe>
  233. </div></div>
  234. </div>
  235. <div id="sponsors" class="waypoint info">
  236. <div class="column"><div class="column_container"><h1>sponsors</h1>
  237. <p>CDNJS is a non-profit initiative and relies heavily on support from the community. Besides our major sponsor <a href="http://cloudflare.com" target="_blank">CloudFlare</a>, we also have <a target="_blank" href="http://pingdom.com">Pingdom</a> and <a href="http://s3stat.com" target="_blank">S3Stat</a> offering their services.</p>
  238. </div></div>
  239. <div class="column"><div class="column_container">
  240. <a href="http://cloudflare.com"><img src="/images/poweredbycloudflare.png" /></a>
  241. <p style="">
  242. At CloudFlare, we believe that open source, community-driven projects like CDNJS are the tools upon which the future of the internet will be built. CloudFlare is proud to provide the global CDN infrastructure that will help power that future.
  243. </p>
  244. </div></div>
  245. </div>
  246. <div id="about" class="waypoint info">
  247. <div class="column"><div class="column_container"><h1>about</h1>
  248. <p>
  249. CDNJS was started in January 2011 as an attempt to speed up the web. It was hosted on Amazon until <a href="http://cloudflare.com" target="_blank">CloudFlare</a> took over hosting using their own CDN in June 2011.
  250. <br />
  251. <br />
  252. At the moment the site itself is managed by two passionate web-developers from Australia. Feel free to get in contact with us at anytime.
  253. <br />
  254. <br />
  255. Ryan Kirkman - <a href="http://ryankirkman.github.com" target="_blank">http://ryankirkman.github.com</a><br />
  256. <a href="http://twitter.com/ryan_kirkman" class="twitter-follow-button">Follow @ryan_kirkman</a>
  257. <br /><br />
  258. Thomas Davis - <a href="http://thomasdavis.github.com" target="_blank">http://thomasdavis.github.com</a><br />
  259. <a href="http://twitter.com/neutralthoughts" class="twitter-follow-button">Follow @neutralthoughts</a>
  260. <br /><br />Join us on IRC at <a href="http://webchat.freenode.net/?channels=cdnjs" target="_blank">#cdnjs</a>(new window) on freenode.net</p>
  261. <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
  262. </div></div>
  263. <div class="column"><div class="column_container">
  264. <p style="font-size: 14px; margin-left: 34px; margin-top: 15px; margin-bottom: 15px; text-align: center;"><strong>Uptime and response times:</strong> <br />
  265. <br /> </div></div>
  266. </div>
  267. <div style="clear: both;"></div>
  268. </div> <!-- container -->
  269. <div id="templates" style="display: none;">
  270. <script type="text/template" id="search_form_template">
  271. <ul class="menu" style="margin-top: 5px;">
  272. <li>search</li>
  273. <li><a href="#/search/tag/popular">popular</a></li>
  274. <li><a href="#/search/tag/all">all</a></li>
  275. </ul>
  276. <input type="text" id="searchinput" />
  277. </script>
  278. <script type="text/template" id="search_results_template">
  279. <ul>
  280. <% _.each( results, function( result ) {
  281. name = result.get("name");
  282. version = result.get("version");
  283. filename = result.get("filename");
  284. repositories = result.get("repositories");
  285. homepage = result.get("homepage");
  286. tags = result.get("keywords");
  287. maintainers = result.get("maintainers");
  288. linka = "http://cdn.sdslabs.co.in/cdnjs/ajax/libs/" + name + "/" + version + "/" + filename;
  289. %>
  290. <li>
  291. <h3>
  292. <span><a target="_blank" href="<%= homepage %>"> <%= name %></a> (<%= version %>)</span
  293. <span style="float: right;">
  294. <% _.each( repositories, function( repo ) { %>
  295. <!--<a href="<%= repo.url %>" target="_blank"><img src="images/<%= repo.type %>.png" /></a>-->
  296. <% }); %>
  297. </span>
  298. </h3>
  299. <input class="cdnlink" type="text" value="<%= linka %>" />
  300. <p>Tags:
  301. <% _.each( tags, function( tag ) { %>
  302. <a href="#/search/tag/<%= tag %>"><%= tag %></a>
  303. <% }); %>
  304. </p>
  305. <p>Maintainers:
  306. <% _.each( maintainers, function( maintainer ) { %>
  307. <a href="#/search/author/<%= maintainer.name.replace(/ /g, "") %>"><%= maintainer.name %></a>
  308. <% }); %>
  309. </p>
  310. </li>
  311. <% }); %>
  312. </ul>
  313. </script>
  314. </div>
  315. </body>
  316. </html>