Commit 283ad2e69d875384adfd2a22fb2ab6b849f74f19
Committed by
Antonio Terceiro
1 parent
81029a02
Exists in
master
and in
29 other branches
ActionItem785: allowing videos from dailymotion and youtube
* Adding tags object and embed to allowed_tags for sanitize * Fixing lightbox. It was appearing behind videos
Showing
2 changed files
with
23 additions
and
6 deletions
Show diff stats
config/environment.rb
... | ... | @@ -66,8 +66,11 @@ Rails::Initializer.run do |config| |
66 | 66 | } |
67 | 67 | |
68 | 68 | # Adds custom attributes to the Set of allowed html attributes for the #sanitize helper |
69 | - config.action_view.sanitized_allowed_attributes = 'align', 'border', 'alt', 'vspace', 'hspace', 'width', 'heigth', 'align' | |
69 | + config.action_view.sanitized_allowed_attributes = 'align', 'border', 'alt', 'vspace', 'hspace', 'width', 'heigth', 'value', 'type', 'data', 'style' | |
70 | 70 | |
71 | + # Adds custom tags to the Set of allowed html tags for the #sanitize helper | |
72 | + config.action_view.sanitized_allowed_tags = 'object', 'embed', 'param' | |
73 | + | |
71 | 74 | # See Rails::Configuration for more options |
72 | 75 | |
73 | 76 | extra_controller_dirs.each do |item| | ... | ... |
public/javascripts/lightbox.js
... | ... | @@ -76,6 +76,7 @@ lightbox.prototype = { |
76 | 76 | this.setScroll(0,0); |
77 | 77 | this.hideSelects('hidden'); |
78 | 78 | } |
79 | + this.hideObjectsAndEmbeds('hidden'); | |
79 | 80 | this.displayLightbox("block"); |
80 | 81 | }, |
81 | 82 | |
... | ... | @@ -84,7 +85,7 @@ lightbox.prototype = { |
84 | 85 | bod = document.getElementsByTagName('body')[0]; |
85 | 86 | bod.style.height = height; |
86 | 87 | bod.style.overflow = overflow; |
87 | - | |
88 | + | |
88 | 89 | htm = document.getElementsByTagName('html')[0]; |
89 | 90 | htm.style.height = height; |
90 | 91 | htm.style.overflow = overflow; |
... | ... | @@ -97,7 +98,20 @@ lightbox.prototype = { |
97 | 98 | selects[i].style.visibility = visibility; |
98 | 99 | } |
99 | 100 | }, |
100 | - | |
101 | + | |
102 | + // In FF, objects and embeds elements hover on top of the lightbox | |
103 | + hideObjectsAndEmbeds: function(visibility){ | |
104 | + var f = function(collection) { | |
105 | + for(i = 0; i < collection.length; i++) { | |
106 | + if (collection[i].style) { | |
107 | + collection[i].style.visibility = visibility; | |
108 | + } | |
109 | + } | |
110 | + }; | |
111 | + f(document.getElementsByTagName('object')); | |
112 | + f(document.getElementsByTagName('embed')); | |
113 | + }, | |
114 | + | |
101 | 115 | // Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ |
102 | 116 | getScroll: function(){ |
103 | 117 | if (self.pageYOffset) { |
... | ... | @@ -122,8 +136,8 @@ lightbox.prototype = { |
122 | 136 | // Begin Ajax request based off of the href of the clicked linked |
123 | 137 | loadInfo: function() { |
124 | 138 | var myAjax = new Ajax.Request( |
125 | - this.content, | |
126 | - {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} | |
139 | + this.content, | |
140 | + {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} | |
127 | 141 | ); |
128 | 142 | |
129 | 143 | }, |
... | ... | @@ -168,7 +182,7 @@ lightbox.prototype = { |
168 | 182 | this.prepareIE("auto", "auto"); |
169 | 183 | this.hideSelects("visible"); |
170 | 184 | } |
171 | - | |
185 | + this.hideObjectsAndEmbeds("visible"); | |
172 | 186 | this.displayLightbox("none"); |
173 | 187 | } |
174 | 188 | } | ... | ... |