Merge lp:~ev/ubiquity-slideshow-ubuntu/reflection into lp:ubiquity-slideshow-ubuntu
- reflection
- Merge into html
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~ev/ubiquity-slideshow-ubuntu/reflection |
Merge into: | lp:ubiquity-slideshow-ubuntu |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~ev/ubiquity-slideshow-ubuntu/reflection |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dylan McCall | Approve | ||
Review via email: mp+11959@code.launchpad.net |
Commit message
Description of the change
Dylan McCall (dylanmccall) wrote : | # |
> Javascript-based reflection for the Firefox icon. Note that the Firefox icon
> is sourced from the running filesystem, not an included copy, so Ubuntu-based
> distributions that ship Abrowser do not have to build their own slideshow
> package.
I should point out that saying the name "Firefox" when a distro is in fact shipping "Iceweasel", for instance, is the same as shipping the icon from Firefox. (A misuse of Mozilla's branding). So, that issue isn't really solved automatically, unfortunately. Of course at this point it isn't a legal problem; just something that could confuse end users. (I think. I've been reading Sam & Max comics all morning, so my legal advice probably shouldn't be trusted!).
Comparing this and the existing solution side by side, I don't see anything really lost except for a tiny morsel of portability, which we don't really need to worry about. (My firefox-3.5 is Shiretoko). Of course, the reflections aren't as pretty as the ones courtesy of GIMP, but they work and I didn't find the difference too distracting. Most people probably won't notice. (Most other icons don't have content going edge to edge like Firefox's, so they need to be autocropped, which our icon build script also does).
It certainly is nice to have the real Firefox logo in Karmic :)
Would be EVEN nicer if we had bigger pngs to work with than 128x128, but c'est la vie...
Thanks for the fix to the build dependencies, too. (I felt mighty silly for not thinking of that!). I filed a bug report with translate-toolkit for the odd behaviour, so maybe we can remove that backwards dependency in 10.04, hopefully.
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2009-09-17 07:43:35 +0000 |
3 | +++ debian/changelog 2009-09-17 11:12:08 +0000 |
4 | @@ -2,6 +2,8 @@ |
5 | |
6 | * The buildds do not install recommends by default, so add a build |
7 | dependency on python-utidylib (LP: #430719). |
8 | + * Add the Firefox icon and a javascript-based reflection for it |
9 | + (LP: #421864). |
10 | |
11 | -- Evan Dandrea <evand@ubuntu.com> Thu, 17 Sep 2009 08:43:03 +0100 |
12 | |
13 | |
14 | === modified file 'slides/firefox.html' |
15 | --- slides/firefox.html 2009-09-15 03:00:32 +0000 |
16 | +++ slides/firefox.html 2009-09-17 11:12:08 +0000 |
17 | @@ -9,5 +9,7 @@ |
18 | </ul></div> |
19 | |
20 | </div> |
21 | - |
22 | -<img class="icon" src="icons/web.png" alt="" /> |
23 | +<!-- We use the absolute path to the Firefox icon rather than an image from |
24 | +slides/icons because we don't know at build time if this will be the real |
25 | +Firefox icon or the Abrowser one. --> |
26 | +<p class="icon"><img src="/usr/share/pixmaps/firefox-3.5.png" id="reflection" /></p> |
27 | |
28 | === modified file 'slides/index.html' |
29 | --- slides/index.html 2009-08-27 15:07:21 +0000 |
30 | +++ slides/index.html 2009-09-17 11:12:08 +0000 |
31 | @@ -19,6 +19,7 @@ |
32 | <script type="text/javascript" src="link/crossfade.js"></script> |
33 | |
34 | <script type="text/javascript" src="directory.js"></script> |
35 | + <script src="link/scriptaculous.js" type="text/javascript"></script> |
36 | </head> |
37 | |
38 | <body> |
39 | @@ -98,6 +99,50 @@ |
40 | }; |
41 | var cf2 = new Crossfade('slideshow'); |
42 | </script> |
43 | +<script type="text/javascript"> |
44 | +var Reflector = { |
45 | + reflect: function(element) { |
46 | + element = $(element); |
47 | + options = $H({ |
48 | + amount: 1/3, |
49 | + opacity: 1/3, |
50 | + fade: 2, |
51 | + blur: 0 |
52 | + }).merge(arguments[1] || {}); |
53 | + |
54 | + var p = element.parentNode, n = element.nextSibling; |
55 | + var d = 1.0/(element.height*options.amount); |
56 | + var f = document.createDocumentFragment(); |
57 | + |
58 | + (element.height*options.amount).times( function(line) { |
59 | + var blurdir = 0; |
60 | + var opacitymodifier= 1; |
61 | + var heightmodifier= 1; |
62 | + if (options.blur==1) { |
63 | + blurdir = (line % 2); |
64 | + opacitymodifier = 2; |
65 | + heightmodifier = 3; |
66 | + } |
67 | + var h = Builder.node('div',{ |
68 | + style: 'height:'+heightmodifier+'px; width:'+element.width+'px;' |
69 | + +'background-image:url('+element.src+');' |
70 | + +'background-position:0'+(heightmodifier-2)+'px 0'+(line+1)+'px;' |
71 | + +'overflow:hidden;' |
72 | + +'margin-top:-'+(heightmodifier-1)+'px;' |
73 | + }); |
74 | + $(h).setOpacity(Math.pow(1-d*line,options.fade)*options.opacity/opacitymodifier); // IE needs the $() |
75 | + f.appendChild(h); |
76 | + }); |
77 | + |
78 | + // update the view now |
79 | + p.insertBefore(f,n); |
80 | + } |
81 | +} |
82 | + |
83 | +Event.observe(window,'load', function(){ |
84 | + Reflector.reflect('reflection',{ amount:2/3, opacity:1/2, blur:1 }); |
85 | +}); |
86 | +</script> |
87 | |
88 | <div id="debug-controls"> |
89 | <input type="button" onclick="cf2.previous()" value="<"/> |
90 | |
91 | === added file 'slides/link/builder.js' |
92 | --- slides/link/builder.js 1970-01-01 00:00:00 +0000 |
93 | +++ slides/link/builder.js 2009-09-17 11:12:08 +0000 |
94 | @@ -0,0 +1,154 @@ |
95 | +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
96 | +// |
97 | +// Permission is hereby granted, free of charge, to any person obtaining |
98 | +// a copy of this software and associated documentation files (the |
99 | +// "Software"), to deal in the Software without restriction, including |
100 | +// without limitation the rights to use, copy, modify, merge, publish, |
101 | +// distribute, sublicense, and/or sell copies of the Software, and to |
102 | +// permit persons to whom the Software is furnished to do so, subject to |
103 | +// the following conditions: |
104 | +// |
105 | +// The above copyright notice and this permission notice shall be |
106 | +// included in all copies or substantial portions of the Software. |
107 | +// |
108 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
109 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
110 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
111 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
112 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
113 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
114 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
115 | +// |
116 | +// For details, see the script.aculo.us web site: http://script.aculo.us/ |
117 | + |
118 | +// script.aculo.us builder.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 |
119 | + |
120 | +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
121 | +// |
122 | +// script.aculo.us is freely distributable under the terms of an MIT-style license. |
123 | +// For details, see the script.aculo.us web site: http://script.aculo.us/ |
124 | + |
125 | +var Builder = { |
126 | + NODEMAP: { |
127 | + AREA: 'map', |
128 | + CAPTION: 'table', |
129 | + COL: 'table', |
130 | + COLGROUP: 'table', |
131 | + LEGEND: 'fieldset', |
132 | + OPTGROUP: 'select', |
133 | + OPTION: 'select', |
134 | + PARAM: 'object', |
135 | + TBODY: 'table', |
136 | + TD: 'table', |
137 | + TFOOT: 'table', |
138 | + TH: 'table', |
139 | + THEAD: 'table', |
140 | + TR: 'table' |
141 | + }, |
142 | + // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, |
143 | + // due to a Firefox bug |
144 | + node: function(elementName) { |
145 | + elementName = elementName.toUpperCase(); |
146 | + |
147 | + // try innerHTML approach |
148 | + var parentTag = this.NODEMAP[elementName] || 'div'; |
149 | + var parentElement = document.createElement(parentTag); |
150 | + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 |
151 | + parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; |
152 | + } catch(e) {} |
153 | + var element = parentElement.firstChild || null; |
154 | + |
155 | + // see if browser added wrapping tags |
156 | + if(element && (element.tagName != elementName)) |
157 | + element = element.getElementsByTagName(elementName)[0]; |
158 | + |
159 | + // fallback to createElement approach |
160 | + if(!element) element = document.createElement(elementName); |
161 | + |
162 | + // abort if nothing could be created |
163 | + if(!element) return; |
164 | + |
165 | + // attributes (or text) |
166 | + if(arguments[1]) |
167 | + if(this._isStringOrNumber(arguments[1]) || |
168 | + (arguments[1] instanceof Array)) { |
169 | + this._children(element, arguments[1]); |
170 | + } else { |
171 | + var attrs = this._attributes(arguments[1]); |
172 | + if(attrs.length) { |
173 | + try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 |
174 | + parentElement.innerHTML = "<" +elementName + " " + |
175 | + attrs + "></" + elementName + ">"; |
176 | + } catch(e) {} |
177 | + element = parentElement.firstChild || null; |
178 | + // workaround firefox 1.0.X bug |
179 | + if(!element) { |
180 | + element = document.createElement(elementName); |
181 | + for(attr in arguments[1]) |
182 | + element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; |
183 | + } |
184 | + if(element.tagName != elementName) |
185 | + element = parentElement.getElementsByTagName(elementName)[0]; |
186 | + } |
187 | + } |
188 | + |
189 | + // text, or array of children |
190 | + if(arguments[2]) |
191 | + this._children(element, arguments[2]); |
192 | + |
193 | + return element; |
194 | + }, |
195 | + _text: function(text) { |
196 | + return document.createTextNode(text); |
197 | + }, |
198 | + |
199 | + ATTR_MAP: { |
200 | + 'className': 'class', |
201 | + 'htmlFor': 'for' |
202 | + }, |
203 | + |
204 | + _attributes: function(attributes) { |
205 | + var attrs = []; |
206 | + for(attribute in attributes) |
207 | + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + |
208 | + '="' + attributes[attribute].toString().escapeHTML() + '"'); |
209 | + return attrs.join(" "); |
210 | + }, |
211 | + _children: function(element, children) { |
212 | + if(typeof children=='object') { // array can hold nodes and text |
213 | + children.flatten().each( function(e) { |
214 | + if(typeof e=='object') |
215 | + element.appendChild(e) |
216 | + else |
217 | + if(Builder._isStringOrNumber(e)) |
218 | + element.appendChild(Builder._text(e)); |
219 | + }); |
220 | + } else |
221 | + if(Builder._isStringOrNumber(children)) |
222 | + element.appendChild(Builder._text(children)); |
223 | + }, |
224 | + _isStringOrNumber: function(param) { |
225 | + return(typeof param=='string' || typeof param=='number'); |
226 | + }, |
227 | + build: function(html) { |
228 | + var element = this.node('div'); |
229 | + $(element).update(html.strip()); |
230 | + return element.down(); |
231 | + }, |
232 | + dump: function(scope) { |
233 | + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope |
234 | + |
235 | + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + |
236 | + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + |
237 | + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ |
238 | + "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ |
239 | + "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ |
240 | + "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); |
241 | + |
242 | + tags.each( function(tag){ |
243 | + scope[tag] = function() { |
244 | + return Builder.node.apply(Builder, [tag].concat($A(arguments))); |
245 | + } |
246 | + }); |
247 | + } |
248 | +} |
249 | |
250 | === modified file 'slides/link/effects.js' |
251 | --- slides/link/effects.js 2009-08-10 22:22:22 +0000 |
252 | +++ slides/link/effects.js 2009-09-17 11:12:08 +0000 |
253 | @@ -1,32 +1,25 @@ |
254 | -/* |
255 | -We (ubiquity-slideshow-ubuntu) are only shipping effects.js from |
256 | -Scriptaculous, and for space reasons have removed all other information |
257 | -that was included. Please see the Scriptaculous web site at |
258 | -<http://script.aculo.us> for information on the original software. |
259 | - |
260 | - |
261 | -MIT license: |
262 | -Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
263 | - |
264 | -Permission is hereby granted, free of charge, to any person obtaining |
265 | -a copy of this software and associated documentation files (the |
266 | -"Software"), to deal in the Software without restriction, including |
267 | -without limitation the rights to use, copy, modify, merge, publish, |
268 | -distribute, sublicense, and/or sell copies of the Software, and to |
269 | -permit persons to whom the Software is furnished to do so, subject to |
270 | -the following conditions: |
271 | - |
272 | -The above copyright notice and this permission notice shall be |
273 | -included in all copies or substantial portions of the Software. |
274 | - |
275 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
276 | -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
277 | -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
278 | -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
279 | -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
280 | -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
281 | -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
282 | -*/ |
283 | +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
284 | +// |
285 | +// Permission is hereby granted, free of charge, to any person obtaining |
286 | +// a copy of this software and associated documentation files (the |
287 | +// "Software"), to deal in the Software without restriction, including |
288 | +// without limitation the rights to use, copy, modify, merge, publish, |
289 | +// distribute, sublicense, and/or sell copies of the Software, and to |
290 | +// permit persons to whom the Software is furnished to do so, subject to |
291 | +// the following conditions: |
292 | +// |
293 | +// The above copyright notice and this permission notice shall be |
294 | +// included in all copies or substantial portions of the Software. |
295 | +// |
296 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
297 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
298 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
299 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
300 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
301 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
302 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
303 | +// |
304 | +// For details, see the script.aculo.us web site: http://script.aculo.us/ |
305 | |
306 | // script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 |
307 | |
308 | @@ -1117,4 +1110,4 @@ |
309 | return $(element); |
310 | }; |
311 | |
312 | -Element.addMethods(); |
313 | \ No newline at end of file |
314 | +Element.addMethods(); |
315 | |
316 | === added file 'slides/link/scriptaculous.js' |
317 | --- slides/link/scriptaculous.js 1970-01-01 00:00:00 +0000 |
318 | +++ slides/link/scriptaculous.js 2009-09-17 11:12:08 +0000 |
319 | @@ -0,0 +1,56 @@ |
320 | +/* We (ubiquity-slideshow-ubuntu) are only shipping effects.js, builder.js, and |
321 | +scriptalicious.js from Scriptaculous, and for space reasons have removed some |
322 | +other information that was included. Please see the Scriptaculous web site at |
323 | +<http://script.aculo.us> for information on the original software. */ |
324 | + |
325 | +// script.aculo.us scriptaculous.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 |
326 | + |
327 | +// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) |
328 | +// |
329 | +// Permission is hereby granted, free of charge, to any person obtaining |
330 | +// a copy of this software and associated documentation files (the |
331 | +// "Software"), to deal in the Software without restriction, including |
332 | +// without limitation the rights to use, copy, modify, merge, publish, |
333 | +// distribute, sublicense, and/or sell copies of the Software, and to |
334 | +// permit persons to whom the Software is furnished to do so, subject to |
335 | +// the following conditions: |
336 | +// |
337 | +// The above copyright notice and this permission notice shall be |
338 | +// included in all copies or substantial portions of the Software. |
339 | +// |
340 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
341 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
342 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
343 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
344 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
345 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
346 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
347 | +// |
348 | +// For details, see the script.aculo.us web site: http://script.aculo.us/ |
349 | + |
350 | +var Scriptaculous = { |
351 | + Version: '1.7.0_beta2', |
352 | + require: function(libraryName) { |
353 | + // inserting via DOM fails in Safari 2.0, so brute force approach |
354 | + document.write('<script type="text/javascript" src="'+libraryName+'"></script>'); |
355 | + }, |
356 | + load: function() { |
357 | + if((typeof Prototype=='undefined') || |
358 | + (typeof Element == 'undefined') || |
359 | + (typeof Element.Methods=='undefined') || |
360 | + parseFloat(Prototype.Version.split(".")[0] + "." + |
361 | + Prototype.Version.split(".")[1]) < 1.5) |
362 | + throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); |
363 | + |
364 | + $A(document.getElementsByTagName("script")).findAll( function(s) { |
365 | + return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) |
366 | + }).each( function(s) { |
367 | + var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); |
368 | + var includes = s.src.match(/\?.*load=([a-z,]*)/); |
369 | + (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each( |
370 | + function(include) { Scriptaculous.require(path+include+'.js') }); |
371 | + }); |
372 | + } |
373 | +} |
374 | + |
375 | +Scriptaculous.load(); |
Javascript-based reflection for the Firefox icon. Note that the Firefox icon is sourced from the running filesystem, not an included copy, so Ubuntu-based distributions that ship Abrowser do not have to build their own slideshow package.