Index: trunk/extensions/VipsScaler/mw.vipsscaler.css |
— | — | @@ -1,5 +0,0 @@ |
2 | | -#mw-vipstest-default-thumb, #mw-vipstest-vips-thumb { |
3 | | - float: left; |
4 | | - margin-top: 1em; |
5 | | - margin-right: 1em; |
6 | | -} |
\ No newline at end of file |
Index: trunk/extensions/VipsScaler/mw.vipsscaler.js |
— | — | @@ -1,38 +0,0 @@ |
2 | | -jQuery( function( $ ) { |
3 | | - var container = document.getElementById( 'mw-vipstest-thumbnails' ); |
4 | | - if ( container ) { |
5 | | - $( '<p id="mw-vipstest-buttons">\n' + |
6 | | - '<button id="mw-vipstest-show-both">' + |
7 | | - mediaWiki.message( 'vipsscaler-show-both' ).escaped() + |
8 | | - '</button> ' + |
9 | | - '<button id="mw-vipstest-show-default">' + |
10 | | - mediaWiki.message( 'vipsscaler-show-default' ).escaped() + |
11 | | - '</button> ' + |
12 | | - '<button id="mw-vipstest-show-vips">' + |
13 | | - mediaWiki.message( 'vipsscaler-show-vips' ).escaped() + |
14 | | - '</button> ' + |
15 | | - '</p>' |
16 | | - ).prependTo( container ); |
17 | | - |
18 | | - |
19 | | - $( '#mw-vipstest-show-both' ).click( function() { |
20 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
21 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
22 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
23 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
24 | | - } ); |
25 | | - $( '#mw-vipstest-show-default' ).click( function() { |
26 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'none'; |
27 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
28 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
29 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'none'; |
30 | | - } ); |
31 | | - $( '#mw-vipstest-show-vips' ).click( function() { |
32 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
33 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'none'; |
34 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'none'; |
35 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
36 | | - } ); |
37 | | - } |
38 | | -} |
39 | | -); |
Index: trunk/extensions/VipsScaler/VipsScaler.php |
— | — | @@ -89,12 +89,26 @@ |
90 | 90 | ), |
91 | 91 | ); |
92 | 92 | |
| 93 | +# Package vipsScaler material in a resource loader module: |
93 | 94 | $wgResourceModules['ext.vipsscaler'] = array( |
94 | | - 'scripts' => array( 'mw.vipsscaler.js', ), |
95 | | - 'styles' => array( 'mw.vipsscaler.css' ), |
| 95 | + 'scripts' => array( 'ext.vipsScaler.js', ), |
| 96 | + 'styles' => array( 'ext.vipsScaler.css' ), |
96 | 97 | 'messages' => array( 'vipsscaler-show-both', 'vipsscaler-show-default', 'vipsscaler-show-vips' ), |
97 | | - 'localBasePath' => dirname( __FILE__ ), |
98 | | - 'remoteExtPath' => 'VipsScaler' |
| 98 | + 'dependencies' => array( |
| 99 | + 'jquery.ucompare', |
| 100 | + ), |
| 101 | + |
| 102 | + 'localBasePath' => dirname( __FILE__ ) . '/modules/ext.vipsScaler', |
| 103 | + 'remoteExtPath' => 'VipsScaler/modules/ext.vipsScaler', |
99 | 104 | ); |
100 | 105 | |
| 106 | +# Also package upstream jquery.ucompare |
| 107 | +$wgResourceModules['jquery.ucompare'] = array( |
| 108 | + 'scripts' => array( 'js/jquery.ucompare.js', ), |
| 109 | + 'styles' => array( 'css/jquery.ucompare.css' ), |
101 | 110 | |
| 111 | + 'localBasePath' => dirname( __FILE__ ) . '/modules/jquery.ucompare', |
| 112 | + 'remoteExtPath' => 'VipsScaler/modules/jquery.ucompare' |
| 113 | +); |
| 114 | + |
| 115 | + |
Index: trunk/extensions/VipsScaler/SpecialVipsTest.php |
— | — | @@ -100,19 +100,20 @@ |
101 | 101 | |
102 | 102 | # Add to output |
103 | 103 | $html = Html::rawElement( 'div', array( 'id' => 'mw-vipstest-thumbnails' ), |
104 | | - Html::rawElement( 'div', array( 'id' => 'mw-vipstest-default-thumb' ), |
105 | | - Html::element( 'img', array( 'src' => $normalThumbUrl ) ) . ' ' . |
106 | | - wfMessage( 'vipsscaler-default-thumb' )->parseAsBlock() |
107 | | - ) |
108 | | - . ' ' . |
109 | | - Html::rawElement( 'div', array( 'id' => 'mw-vipstest-vips-thumb' ), |
110 | | - Html::element( 'img', array( 'src' => $vipsThumbUrl ) ) . ' ' . |
111 | | - wfMessage( 'vipsscaler-vips-thumb' )->parseAsBlock() |
112 | | - ) |
113 | | - ); |
114 | | - |
| 104 | + Html::element( 'img', array( |
| 105 | + 'src' => $normalThumbUrl, |
| 106 | + 'alt' => wfMessage( 'vipsscaler-default-thumb' ), |
| 107 | + ) ) . ' ' . |
| 108 | + Html::element( 'img', array( |
| 109 | + 'src' => $vipsThumbUrl, |
| 110 | + 'alt' => wfMessage( 'vipsscaler-vips-thumb' ), |
| 111 | + ) ) |
| 112 | + ); |
115 | 113 | $this->getOutput()->addHTML( $html ); |
116 | | - $this->getOutput()->addModules( 'ext.vipsscaler' ); |
| 114 | + $this->getOutput()->addModules( array( |
| 115 | + 'ext.vipsscaler', |
| 116 | + 'jquery.ucompare', |
| 117 | + ) ); |
117 | 118 | } |
118 | 119 | |
119 | 120 | /** |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/license.gz |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/license.gz |
___________________________________________________________________ |
Added: svn:mime-type |
120 | 121 | + application/octet-stream |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/css/jquery.ucompare.css |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +/*! |
| 3 | + * jQuery uCompare |
| 4 | + * http://www.userdot.net/#!/jquery |
| 5 | + * |
| 6 | + * Copyright 2011, UserDot www.userdot.net |
| 7 | + * Licensed under the GPL Version 3 license. |
| 8 | + * Version 1.0.0 |
| 9 | + * |
| 10 | + */ |
| 11 | + .uc-mask {position:absolute; top:0; left:0; z-index:100; border-right:3px solid #333; overflow:hidden; box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.6);box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 0 7px rgba(0, 0, 0, 0.6);} |
| 12 | +.uc-bg {position:absolute; top:0; left:0; z-index:0;} |
| 13 | +.uc-caption {position:absolute; bottom:10px; left:10px; z-index:120; background:#000; filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity: 0.8;opacity: 0.8; color:#fff; text-align:center;-webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; padding:5px; font-size:12px; font-family:arial; display:none;} |
\ No newline at end of file |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/css/jquery.ucompare.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/css/index.html |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/css/index.html |
___________________________________________________________________ |
Added: svn:eol-style |
2 | 15 | + native |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/index.html |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/index.html |
___________________________________________________________________ |
Added: svn:eol-style |
3 | 16 | + native |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/js/jquery.ucompare.js |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +/*! |
| 3 | + * jQuery uCompare |
| 4 | + * http://www.userdot.net/#!/jquery |
| 5 | + * |
| 6 | + * Copyright 2011, UserDot www.userdot.net |
| 7 | + * Licensed under the GPL Version 3 license. |
| 8 | + * Version 1.0.0 |
| 9 | + * |
| 10 | + */ |
| 11 | +(function ($) { |
| 12 | + $.fn.extend({ |
| 13 | + ucompare: function (b) { |
| 14 | + var c = { |
| 15 | + defaultgap: 50, |
| 16 | + leftgap: 10, |
| 17 | + rightgap: 10, |
| 18 | + caption: false, |
| 19 | + reveal: .5 |
| 20 | + }; |
| 21 | + var b = $.extend(c, b); |
| 22 | + return this.each(function () { |
| 23 | + var c = b; |
| 24 | + var d = $(this); |
| 25 | + var e = d.children("img:eq(0)").attr("src"); |
| 26 | + var f = d.children("img:eq(1)").attr("src"); |
| 27 | + var g = d.children("img:eq(0)").attr("alt"); |
| 28 | + var h = d.children("img:eq(0)").width(); |
| 29 | + var i = d.children("img:eq(0)").height(); |
| 30 | + d.children("img").hide(); |
| 31 | + d.css({ |
| 32 | + overflow: "hidden", |
| 33 | + position: "relative" |
| 34 | + }); |
| 35 | + d.append('<div class="uc-mask"></div>'); |
| 36 | + d.append('<div class="uc-bg"></div>'); |
| 37 | + d.append('<div class="uc-caption">' + g + "</div>"); |
| 38 | + d.children(".uc-mask, .uc-bg").width(h); |
| 39 | + d.children(".uc-mask, .uc-bg").height(i); |
| 40 | + d.children(".uc-mask").animate({ |
| 41 | + width: h - c.defaultgap |
| 42 | + }, 1e3); |
| 43 | + d.children(".uc-mask").css("backgroundImage", "url(" + e + ")"); |
| 44 | + d.children(".uc-bg").css("backgroundImage", "url(" + f + ")"); |
| 45 | + if (c.caption) d.children(".uc-caption").show() |
| 46 | + }).mousemove(function (c) { |
| 47 | + var d = b; |
| 48 | + var e = $(this); |
| 49 | + pos_img = e.position()["left"]; |
| 50 | + pos_mouse = c.pageX - e.children(".uc-mask").offset().left; |
| 51 | + new_width = pos_mouse - pos_img; |
| 52 | + img_width = e.width(); |
| 53 | + img_cap_one = e.children("img:eq(0)").attr("alt"); |
| 54 | + img_cap_two = e.children("img:eq(1)").attr("alt"); |
| 55 | + if (new_width > d.leftgap && new_width < img_width - d.rightgap) { |
| 56 | + e.children(".uc-mask").width(new_width) |
| 57 | + } |
| 58 | + if (new_width < img_width * d.reveal) { |
| 59 | + e.children(".uc-caption").html(img_cap_two) |
| 60 | + } else { |
| 61 | + e.children(".uc-caption").html(img_cap_one) |
| 62 | + } |
| 63 | + }) |
| 64 | + } |
| 65 | + }) |
| 66 | +})(jQuery) |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/js/jquery.ucompare.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 67 | + native |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/js/index.html |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/js/index.html |
___________________________________________________________________ |
Added: svn:eol-style |
2 | 68 | + native |
Index: trunk/extensions/VipsScaler/modules/jquery.ucompare/README |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +The jQuery uCompare is a jQuery plugin written by Marius Stanciu - Sergiu |
| 3 | +for Userdot, a plugin which gives you the ability to compare two images |
| 4 | +(before and after, etc) via a nice interface. |
| 5 | + |
| 6 | +Source: http://www.userdot.net/files/jquery/jquery.ucompare/ |
| 7 | +Demo: http://www.userdot.net/files/jquery/jquery.ucompare/demo/ |
| 8 | + |
| 9 | +-- |
| 10 | +Copied to MediaWiki subversion repository on 2011-11-15 by hashar |
Property changes on: trunk/extensions/VipsScaler/modules/jquery.ucompare/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.css |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +#mw-vipstest-default-thumb, #mw-vipstest-vips-thumb { |
| 3 | + float: left; |
| 4 | + margin-top: 1em; |
| 5 | + margin-right: 1em; |
| 6 | +} |
Property changes on: trunk/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.js |
— | — | @@ -0,0 +1,57 @@ |
| 2 | +jQuery( function( $ ) { |
| 3 | + var container = document.getElementById( 'mw-vipstest-thumbnails' ); |
| 4 | + if ( container ) { |
| 5 | +/* |
| 6 | + $( '<p id="mw-vipstest-buttons">\n' + |
| 7 | + '<button id="mw-vipstest-show-both">' + |
| 8 | + mediaWiki.message( 'vipsscaler-show-both' ).escaped() + |
| 9 | + '</button> ' + |
| 10 | + '<button id="mw-vipstest-show-default">' + |
| 11 | + mediaWiki.message( 'vipsscaler-show-default' ).escaped() + |
| 12 | + '</button> ' + |
| 13 | + '<button id="mw-vipstest-show-vips">' + |
| 14 | + mediaWiki.message( 'vipsscaler-show-vips' ).escaped() + |
| 15 | + '</button> ' + |
| 16 | + '</p>' |
| 17 | + ).prependTo( container ); |
| 18 | +*/ |
| 19 | +/** |
| 20 | + $( '#mw-vipstest-show-both' ).click( function() { |
| 21 | + document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
| 22 | + document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
| 23 | + document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
| 24 | + document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
| 25 | + } ); |
| 26 | + $( '#mw-vipstest-show-default' ).click( function() { |
| 27 | + document.getElementById( 'mw-vipstest-show-default' ).style.display = 'none'; |
| 28 | + document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
| 29 | + document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
| 30 | + document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'none'; |
| 31 | + } ); |
| 32 | + $( '#mw-vipstest-show-vips' ).click( function() { |
| 33 | + document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
| 34 | + document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'none'; |
| 35 | + document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'none'; |
| 36 | + document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
| 37 | + } ); |
| 38 | +**/ |
| 39 | + /** |
| 40 | + * options are detailed in upstream documentation available at |
| 41 | + * http://www.userdot.net/files/jquery/jquery.ucompare/demo/ |
| 42 | + * |
| 43 | + * Copying them here for version 1.0 |
| 44 | + * - caption: toggle the |
| 45 | + * - leftgap: the gap to the left of the image |
| 46 | + * - rightgap: the gap to the right of the image |
| 47 | + * - defaultgap: the default gap shown before any interactions |
| 48 | + */ |
| 49 | + $('#mw-vipstest-thumbnails').ucompare({ |
| 50 | + defaultgap: 50, |
| 51 | + leftgap: 0, |
| 52 | + rightgap: 0, |
| 53 | + caption: true, |
| 54 | + reveal: 0.5 |
| 55 | + }); |
| 56 | + } |
| 57 | +} |
| 58 | +); |
Property changes on: trunk/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 59 | + native |