Advertisement
Guest User

Untitled

a guest
Jun 25th, 2012
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.60 KB | None | 0 0
  1. diff -urN classic/javascripts/theme.js classic.patched/javascripts/theme.js
  2. --- classic/javascripts/theme.js    1970-01-01 03:00:00.000000000 +0300
  3. +++ classic.patched/javascripts/theme.js    2012-06-26 03:40:16.000000000 +0400
  4. @@ -0,0 +1,70 @@
  5. +Event.observe(window, 'load', function() {
  6. +   /* add onclick="lightbox.click();" to all <img> tags which doesnt have onclick action */
  7. +   adaptImages();
  8. +   /* add additional divs for lightbox & curtain tags before </body> tag */
  9. +   var objBody = $$('body')[0];
  10. +   objBody.insert({'bottom' : "<div id='lightbox' class='lightbox hidden'></div>\n<div id='curtain' class='curtain hidden'></div>"});
  11. +  
  12. +});
  13. +
  14. +//checks for all <img> tags on the page without onclick function defined
  15. +function adaptImages() {
  16. +    var images = document.getElementsByTagName('img');
  17. +    for (i = 0; i != images.length; i++) {
  18. +        images[i].onclick = (function () {
  19. +            var origOnClick = images[i].onclick;
  20. +            return function (e) {
  21. +                if (origOnClick != null && !origOnClick()) {
  22. +                    return false;
  23. +                }
  24. +                // do new onclick handling only if
  25. +                // original onclick returns true
  26. +                lightbox.init(this,500);
  27. +                return true;
  28. +            }
  29. +        })();
  30. +    }
  31. +}
  32. +
  33. +
  34. +//Lightbox stuff
  35. +var lightbox = {
  36. +   init: function (image, size) {
  37. +       if(typeof(image)=='string') {
  38. +                        var src = image;
  39. +                        image = new Image();
  40. +                        image.src = src;
  41. +                }
  42. +       if (image.naturalWidth === undefined) {
  43. +           var tmp = document.createElement('img');
  44. +           tmp.style.visibility = 'hidden';
  45. +           tmp.src = image.src;
  46. +           image.naturalWidth = tmp.width;
  47. +           delete tmp;
  48. +       }
  49. +       if (image.naturalWidth > size) {
  50. +           lightbox.box(image);           
  51. +       }
  52. +   },
  53. +   box: function (image) {
  54. +       var hasA = false;
  55. +       if(image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') {
  56. +           hasA = true;
  57. +       }
  58. +       if(!hasA) {
  59. +           $('lightbox').removeClassName('hidden');
  60. +           $('lightbox').innerHTML = '<img src="' + image.src + '" />';
  61. +           $('lightbox').onclick = (function(){lightbox.unbox();});
  62. +           $('curtain').removeClassName('hidden');
  63. +           $('curtain').onclick = (function(){lightbox.unbox();});
  64. +  
  65. +       }
  66. +   },
  67. +   unbox: function (data) {
  68. +       $('curtain').addClassName('hidden');
  69. +       $('lightbox').addClassName('hidden');
  70. +       $('lightbox').innerHTML = '';
  71. +   }
  72. +};
  73. +/* End Of Lightbox stuff */
  74. +
  75. diff -urN classic/stylesheets/application.css classic.patched/stylesheets/application.css
  76. --- classic/stylesheets/application.css 2011-12-21 15:44:20.000000000 +0400
  77. +++ classic.patched/stylesheets/application.css 2012-06-26 03:43:35.000000000 +0400
  78. @@ -1,5 +1,43 @@
  79.  @import url(../../../stylesheets/application.css);
  80.  
  81. +/* Lightbox Definitions for image hack */
  82. +.lightbox {
  83. +   position: fixed;
  84. +   text-align: center;
  85. +   top: 5%;
  86. +   left: 5%;
  87. +   width: 90%;
  88. +   height: 90%;
  89. +   padding: 0px;
  90. +   z-index:1002;
  91. +   overflow: auto;
  92. +}
  93. +
  94. +.curtain {
  95. +   position: fixed;
  96. +   top: 0%;
  97. +   left: 0%;
  98. +   width: 100%;
  99. +   height: 100%;
  100. +   background-color: black;
  101. +   z-index:1001;
  102. +   -moz-opacity: 0.8;
  103. +   opacity:.80;
  104. +   filter: alpha(opacity=80);
  105. +}
  106. +
  107. +/* IE doesn't appear to like a simple display:none in our header. Random things start fucking up pretty badly. */
  108. +.hidden {
  109. +   position: absolute;
  110. +   left: -10000px;
  111. +}
  112. +/* End Of */
  113. +
  114. +#content .wiki img {
  115. +   max-width: 500px;
  116. +}
  117. +
  118. +
  119.  body{ color:#303030; background:#e8eaec; }
  120.  
  121.  #top-menu { font-size: 80%; height: 2em; padding-top: 0.5em; background-color: #578bb8; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement