splendeo-lightbox2_helpers 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,8 @@ module Lightbox2Helpers::IncludesHelper
6
6
 
7
7
  # returns an array of javascripts needed (array)
8
8
  def lightbox2_helpers_javascripts()
9
- ["lightbox2_helpers/lightbox.js"]
9
+ ["lightbox2_helpers/builder.js",
10
+ "lightbox2_helpers/lightbox.js"]
10
11
  end
11
12
 
12
13
  # returns html necessary to load javascript and css to make lightbox2_helpers work
@@ -0,0 +1,136 @@
1
+ // script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
2
+
3
+ // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4
+ //
5
+ // script.aculo.us is freely distributable under the terms of an MIT-style license.
6
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
7
+
8
+ var Builder = {
9
+ NODEMAP: {
10
+ AREA: 'map',
11
+ CAPTION: 'table',
12
+ COL: 'table',
13
+ COLGROUP: 'table',
14
+ LEGEND: 'fieldset',
15
+ OPTGROUP: 'select',
16
+ OPTION: 'select',
17
+ PARAM: 'object',
18
+ TBODY: 'table',
19
+ TD: 'table',
20
+ TFOOT: 'table',
21
+ TH: 'table',
22
+ THEAD: 'table',
23
+ TR: 'table'
24
+ },
25
+ // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
26
+ // due to a Firefox bug
27
+ node: function(elementName) {
28
+ elementName = elementName.toUpperCase();
29
+
30
+ // try innerHTML approach
31
+ var parentTag = this.NODEMAP[elementName] || 'div';
32
+ var parentElement = document.createElement(parentTag);
33
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
34
+ parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
35
+ } catch(e) {}
36
+ var element = parentElement.firstChild || null;
37
+
38
+ // see if browser added wrapping tags
39
+ if(element && (element.tagName.toUpperCase() != elementName))
40
+ element = element.getElementsByTagName(elementName)[0];
41
+
42
+ // fallback to createElement approach
43
+ if(!element) element = document.createElement(elementName);
44
+
45
+ // abort if nothing could be created
46
+ if(!element) return;
47
+
48
+ // attributes (or text)
49
+ if(arguments[1])
50
+ if(this._isStringOrNumber(arguments[1]) ||
51
+ (arguments[1] instanceof Array) ||
52
+ arguments[1].tagName) {
53
+ this._children(element, arguments[1]);
54
+ } else {
55
+ var attrs = this._attributes(arguments[1]);
56
+ if(attrs.length) {
57
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
58
+ parentElement.innerHTML = "<" +elementName + " " +
59
+ attrs + "></" + elementName + ">";
60
+ } catch(e) {}
61
+ element = parentElement.firstChild || null;
62
+ // workaround firefox 1.0.X bug
63
+ if(!element) {
64
+ element = document.createElement(elementName);
65
+ for(attr in arguments[1])
66
+ element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
67
+ }
68
+ if(element.tagName.toUpperCase() != elementName)
69
+ element = parentElement.getElementsByTagName(elementName)[0];
70
+ }
71
+ }
72
+
73
+ // text, or array of children
74
+ if(arguments[2])
75
+ this._children(element, arguments[2]);
76
+
77
+ return element;
78
+ },
79
+ _text: function(text) {
80
+ return document.createTextNode(text);
81
+ },
82
+
83
+ ATTR_MAP: {
84
+ 'className': 'class',
85
+ 'htmlFor': 'for'
86
+ },
87
+
88
+ _attributes: function(attributes) {
89
+ var attrs = [];
90
+ for(attribute in attributes)
91
+ attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
92
+ '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
93
+ return attrs.join(" ");
94
+ },
95
+ _children: function(element, children) {
96
+ if(children.tagName) {
97
+ element.appendChild(children);
98
+ return;
99
+ }
100
+ if(typeof children=='object') { // array can hold nodes and text
101
+ children.flatten().each( function(e) {
102
+ if(typeof e=='object')
103
+ element.appendChild(e)
104
+ else
105
+ if(Builder._isStringOrNumber(e))
106
+ element.appendChild(Builder._text(e));
107
+ });
108
+ } else
109
+ if(Builder._isStringOrNumber(children))
110
+ element.appendChild(Builder._text(children));
111
+ },
112
+ _isStringOrNumber: function(param) {
113
+ return(typeof param=='string' || typeof param=='number');
114
+ },
115
+ build: function(html) {
116
+ var element = this.node('div');
117
+ $(element).update(html.strip());
118
+ return element.down();
119
+ },
120
+ dump: function(scope) {
121
+ if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
122
+
123
+ var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
124
+ "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
125
+ "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
126
+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
127
+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
128
+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
129
+
130
+ tags.each( function(tag){
131
+ scope[tag] = function() {
132
+ return Builder.node.apply(Builder, [tag].concat($A(arguments)));
133
+ }
134
+ });
135
+ }
136
+ }
@@ -1,12 +1,16 @@
1
1
  // -----------------------------------------------------------------------------------
2
2
  //
3
- // Lightbox v2.04
4
- // by Lokesh Dhakar - http://www.lokeshdhakar.com
3
+ // Lightbox v2.04 modified for lightbox2_helpers
4
+ // original version by Lokesh Dhakar - http://www.lokeshdhakar.com
5
+ // modified by Enrique Garcia - only change was to the /images/ path
5
6
  // Last Modification: 2/9/08
6
7
  //
7
- // For more information, visit:
8
+ // For more information about lightbox, visit:
8
9
  // http://lokeshdhakar.com/projects/lightbox2/
9
10
  //
11
+ // For more information about lightbox2_helpers, visit:
12
+ // http://github.com/splendeo/lightbox2_helpers/
13
+ //
10
14
  // Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
11
15
  // - Free for use in both personal and commercial projects
12
16
  // - Attribution requires leaving author name, author link, and the license info intact.
@@ -46,8 +50,8 @@
46
50
  // Configurationl
47
51
  //
48
52
  LightboxOptions = Object.extend({
49
- fileLoadingImage: 'images/loading.gif',
50
- fileBottomNavCloseImage: 'images/closelabel.gif',
53
+ fileLoadingImage: '/images/lightbox2_helpers/loading.gif',
54
+ fileBottomNavCloseImage: '/images/lightbox2_helpers/closelabel.gif',
51
55
 
52
56
  overlayOpacity: 0.8, // controls transparency of shadow overlay
53
57
 
@@ -106,7 +110,7 @@ Lightbox.prototype = {
106
110
  // </div>
107
111
  // <div id="loading">
108
112
  // <a href="#" id="loadingLink">
109
- // <img src="images/loading.gif">
113
+ // <img src="/images/lightbox2_helpers/loading.gif">
110
114
  // </a>
111
115
  // </div>
112
116
  // </div>
@@ -119,7 +123,7 @@ Lightbox.prototype = {
119
123
  // </div>
120
124
  // <div id="bottomNav">
121
125
  // <a href="#" id="bottomNavClose">
122
- // <img src="images/close.gif">
126
+ // <img src="/images/lightbox2_helpers/close.gif">
123
127
  // </a>
124
128
  // </div>
125
129
  // </div>
@@ -13,15 +13,15 @@
13
13
  #prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
14
14
  #prevLink { left: 0; float: left;}
15
15
  #nextLink { right: 0; float: right;}
16
- #prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
17
- #nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }
16
+ #prevLink:hover, #prevLink:visited:hover { background: url(/images/lightbox2_helpers/prevlabel.gif) left 15% no-repeat; }
17
+ #nextLink:hover, #nextLink:visited:hover { background: url(/images/lightbox2_helpers/nextlabel.gif) right 15% no-repeat; }
18
18
 
19
19
  #imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
20
20
 
21
21
  #imageData{ padding:0 10px; color: #666; }
22
- #imageData #imageDetails{ width: 70%; float: left; text-align: left; }
23
- #imageData #caption{ font-weight: bold; }
24
- #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
25
- #imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none;}
22
+ #imageData #imageDetails{ width: 70%; float: left; text-align: left; }
23
+ #imageData #caption{ font-weight: bold; }
24
+ #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
25
+ #imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none; }
26
26
 
27
27
  #overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splendeo-lightbox2_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Enrique Garcia Cota (egarcia)
@@ -34,6 +34,7 @@ files:
34
34
  - public/images/lightbox2_helpers/loading.gif
35
35
  - public/images/lightbox2_helpers/nextlabel.gif
36
36
  - public/images/lightbox2_helpers/prevlabel.gif
37
+ - public/javascripts/lightbox2_helpers/builder.js
37
38
  - public/javascripts/lightbox2_helpers/lightbox.js
38
39
  - public/stylesheets/lightbox2_helpers/lightbox.css
39
40
  - README