Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use jquery

  • Loading branch information...
commit 7b2d423be098678e565d7373ccab1dd221eb34d4 1 parent bef854a
Jacques Crocker authored

Showing 2 changed files with 53 additions and 51 deletions. Show diff stats Hide diff stats

  1. +0 1  dynamic/slides/_ie_bullshit.erb
  2. +53 50 layouts/default.erb
1  dynamic/slides/_ie_bullshit.erb
... ... @@ -1,5 +1,4 @@
1 1 <!--[if lt IE 9]>
2   - <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
3 2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
4 3 <script type="text/javascript" src="js/jquery.chrome_frame.js"></script>
5 4
103 layouts/default.erb
@@ -28,6 +28,7 @@
28 28 <link href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono" rel="stylesheet" type="text/css" />
29 29 <link type="text/css" href="./css/slides.css" rel="stylesheet">
30 30
  31 + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
31 32 <%= partial "slides/ie_bullshit" %>
32 33
33 34 <script type="text/javascript" src="http://use.typekit.com/lyq7joq.js"></script>
@@ -50,7 +51,6 @@
50 51 }
51 52 </style>
52 53
53   - <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
54 54 <script>
55 55 (function() {
56 56 var doc = document;
@@ -395,68 +395,71 @@
395 395 }
396 396 };
397 397
398   - var numberToName = {};
399   - var nameToNumber = {};
400   - $(".slide").each(function(index) {
401   - numberToName[index+1] = $(this).attr("data-slidename");
402   - nameToNumber[$(this).attr("data-slidename")] = index+1;
403   - });
  398 + jQuery(window).load(function() {
  399 + var numberToName = {};
  400 + var nameToNumber = {};
  401 + $(".slide").each(function(index) {
  402 + numberToName[index+1] = $(this).attr("data-slidename");
  403 + nameToNumber[$(this).attr("data-slidename")] = index+1;
  404 + });
404 405
405   - // Initialize
406   - console.log(query(".slide"))
407   - var slideshow = new SlideShow(query(".slide"), numberToName, nameToNumber);
  406 + // Initialize
  407 + console.log(query(".slide"))
  408 + var slideshow = new SlideShow(query(".slide"), numberToName, nameToNumber);
408 409
409   - $(".next").each(function() {
410   - var self = $(this);
  410 + $(".next").each(function() {
  411 + var self = $(this);
411 412
412   - // set href hash tag
413   - self.attr("href", "#"+ self.parents(".slide:first").nextAll(".slide:first").attr("data-slidename"))
  413 + // set href hash tag
  414 + self.attr("href", "#"+ self.parents(".slide:first").nextAll(".slide:first").attr("data-slidename"))
414 415
415   - self.click(function(e) {
416   - e.preventDefault();
417   - slideshow.next();
418   - });
419   - })
  416 + self.click(function(e) {
  417 + e.preventDefault();
  418 + slideshow.next();
  419 + });
  420 + })
  421 +
  422 + // $(".home").click(function(e) {
  423 + // e.preventDefault();
  424 + // slideshow.go(1);
  425 + // })
420 426
421   - // $(".home").click(function(e) {
422   - // e.preventDefault();
423   - // slideshow.go(1);
424   - // })
  427 + $(".prev").each(function(e) {
  428 + var self = $(this);
425 429
426   - $(".prev").each(function(e) {
427   - var self = $(this);
  430 + // set href hash tag
  431 + self.attr("href", "#"+ self.parents(".slide:first").prevAll(".slide:first").attr("data-slidename"))
428 432
429   - // set href hash tag
430   - self.attr("href", "#"+ self.parents(".slide:first").prevAll(".slide:first").attr("data-slidename"))
  433 + self.click(function(e) {
  434 + e.preventDefault();
  435 + slideshow.prev();
  436 + });
  437 + })
431 438
432   - self.click(function(e) {
  439 + $(".tweet").click(function(e) {
433 440 e.preventDefault();
434   - slideshow.prev();
435   - });
436   - })
437 441
438   - $(".tweet").click(function(e) {
439   - e.preventDefault();
  442 + var url = $(this).attr("href");
440 443
441   - var url = $(this).attr("href");
  444 + var Z = 550,
  445 + h = 450;
  446 + var c = screen.height;
  447 + var b = screen.width;
  448 + var a = Math.round((b / 2) - (Z / 2));
  449 + var g = 0;
  450 + if (c > h) {
  451 + g = Math.round((c / 2) - (h / 2))
  452 + }
442 453
443   - var Z = 550,
444   - h = 450;
445   - var c = screen.height;
446   - var b = screen.width;
447   - var a = Math.round((b / 2) - (Z / 2));
448   - var g = 0;
449   - if (c > h) {
450   - g = Math.round((c / 2) - (h / 2))
451   - }
  454 + var tweetWindow = window.open(url, "twitter_tweet", "left=" + a + ",top=" + g + ",width=" + Z + ",height=" + h + ",personalbar=no,toolbar=no,scrollbars=yes,location=yes,resizable=yes");
  455 + if (tweetWindow) {
  456 + tweetWindow.focus()
  457 + } else {
  458 + window.location.href = Y
  459 + }
  460 + })
452 461
453   - var tweetWindow = window.open(url, "twitter_tweet", "left=" + a + ",top=" + g + ",width=" + Z + ",height=" + h + ",personalbar=no,toolbar=no,scrollbars=yes,location=yes,resizable=yes");
454   - if (tweetWindow) {
455   - tweetWindow.focus()
456   - } else {
457   - window.location.href = Y
458   - }
459   - })
  462 + });
460 463
461 464 })();
462 465 </script>

0 comments on commit 7b2d423

Please sign in to comment.
Something went wrong with that request. Please try again.