incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterhartm...@apache.org
Subject [2/2] git commit: [#4647] Change maxlength js library to other with compatible licensing
Date Thu, 03 Jan 2013 20:35:30 GMT
Updated Branches:
  refs/heads/ph/4647 63be6b46f -> 42d672dc3


[#4647] Change maxlength js library to other with compatible licensing

Signed-off-by: Peter Hartmann <peterhartmann@apache.org>

Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/42d672dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/42d672dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/42d672dc

Branch: refs/heads/ph/4647
Commit: 42d672dc3a8726d9124299dac63c46704354745b
Parents: 432feb5
Author: Peter Hartmann <peterhartmann@apache.org>
Authored: Thu Jan 3 21:34:47 2013 +0100
Committer: Peter Hartmann <peterhartmann@apache.org>
Committed: Thu Jan 3 21:34:47 2013 +0100

----------------------------------------------------------------------
 .../ext/admin/templates/project_overview.html      |    8 +++++---
 Allura/allura/public/nf/js/jquery.maxlength-min.js |    8 --------
 Allura/allura/public/nf/js/jquery.maxlength.min.js |    7 +++++++
 3 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42d672dc/Allura/allura/ext/admin/templates/project_overview.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_overview.html b/Allura/allura/ext/admin/templates/project_overview.html
index 9695297..705cbee 100644
--- a/Allura/allura/ext/admin/templates/project_overview.html
+++ b/Allura/allura/ext/admin/templates/project_overview.html
@@ -16,10 +16,12 @@
 {% endblock %}
 
 {% block extra_js %}
-  <script type="text/javascript" src="{{g.forge_static('js/jquery.maxlength-min.js')}}"></script>
+  <script type="text/javascript" src="{{g.forge_static('js/jquery.maxlength.min.js')}}"></script>
   <script type="text/javascript">
     /*global confirm: true*/
     $(document).ready(function () {
+      $.maxlength.setDefaults({feedbackText : '{r} characters left'})
+      
       var $metadata_form = $('#metadata_form');
       var $removal_original = $('input[name=removal]:checked');
       var $removal_delete_cb = $('#removal_delete_cb');
@@ -41,8 +43,8 @@
       // manage url input state for support page and removal
       update_url($support_page_url_cb, $support_page_url);
       update_url($removal_moved_cb, $moved_to_url);
-      $('input[name=summary]').maxlength({maxCharacters: 70});
-      $('textarea[name=short_description]').maxlength({maxCharacters: 1000});
+      $('input[name=summary]').maxlength({max: 70});
+      $('textarea[name=short_description]').maxlength({max: 1000});
       $('input[name=support_page]').change(function(){
         update_url($support_page_url_cb, $support_page_url);
       });

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42d672dc/Allura/allura/public/nf/js/jquery.maxlength-min.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/jquery.maxlength-min.js b/Allura/allura/public/nf/js/jquery.maxlength-min.js
deleted file mode 100644
index dfb9250..0000000
--- a/Allura/allura/public/nf/js/jquery.maxlength-min.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * jQuery Maxlength plugin
- * @version		$Id: jquery.maxlength.js 18 2009-05-16 15:37:08Z emil@anon-design.se $
- * @package		jQuery maxlength 1.0.5
- * @copyright	Copyright (C) 2009 Emil Stjerneman / http://www.anon-design.se
- * @license		GNU/GPL, see LICENSE.txt
- */
- (function(A){A.fn.maxlength=function(B){var C=jQuery.extend({events:[],maxCharacters:10,status:true,statusClass:"status",statusText:"characters
left",notificationClass:"notification",showAlert:false,alertText:"You have typed too many
characters.",slider:false},B);A.merge(C.events,["keyup"]);return this.each(function(){var
G=A(this);var J=A(this).val().length;function D(){var K=C.maxCharacters-J;if(K<0){K=0}G.next("div").html(K+"
"+C.statusText)}function E(){var K=true;if(J>=C.maxCharacters){K=false;G.addClass(C.notificationClass);G.val(G.val().substr(0,C.maxCharacters));I()}else{if(G.hasClass(C.notificationClass)){G.removeClass(C.notificationClass)}}if(C.status){D()}}function
I(){if(C.showAlert){alert(C.alertText)}}function F(){var K=false;if(G.is("textarea")){K=true}else{if(G.filter("input[type=text]")){K=true}else{if(G.filter("input[type=password]")){K=true}}}return
K}if(!F()){return false}A.each(C.events,function(K,L){G.bind(L,function(M){J=G.val().length;E()})});if(C.status){G.
 after(A("<div/>").addClass(C.statusClass).html("-"));D()}if(!C.status){var H=G.next("div."+C.statusClass);if(H){H.remove()}}if(C.slider){G.next().hide();G.focus(function(){G.next().slideDown("fast")});G.blur(function(){G.next().slideUp("fast")})}})}})(jQuery);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42d672dc/Allura/allura/public/nf/js/jquery.maxlength.min.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/jquery.maxlength.min.js b/Allura/allura/public/nf/js/jquery.maxlength.min.js
new file mode 100644
index 0000000..b339890
--- /dev/null
+++ b/Allura/allura/public/nf/js/jquery.maxlength.min.js
@@ -0,0 +1,7 @@
+/* http://keith-wood.name/maxlength.html
+   Textarea Max Length for jQuery v1.1.0.
+   Written by Keith Wood (kwood{at}iinet.com.au) May 2009.
+   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt)
and 
+   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
+   Please attribute the author if you use it. */
+(function($){function MaxLength(){this.regional=[];this.regional['']={feedbackText:'{r} characters
remaining ({m} maximum)',overflowText:'{o} characters too many ({m} maximum)'};this._defaults={max:200,truncate:true,showFeedback:true,feedbackTarget:null,onFull:null};$.extend(this._defaults,this.regional[''])}$.extend(MaxLength.prototype,{markerClassName:'hasMaxLength',propertyName:'maxlength',_feedbackClass:'maxlength-feedback',_fullClass:'maxlength-full',_overflowClass:'maxlength-overflow',_disabledClass:'maxlength-disabled',setDefaults:function(a){$.extend(this._defaults,a||{});return
this},_attachPlugin:function(c,d){c=$(c);if(c.hasClass(this.markerClassName)){return}var e={options:$.extend({},this._defaults),feedbackTarget:$([])};c.addClass(this.markerClassName).data(this.propertyName,e).bind('keypress.'+this.propertyName,function(a){if(!e.options.truncate){return
true}var b=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return(a.ctrlKey||a.metaKey||b=='\u0000'|
 |$(this).val().length<e.options.max)}).bind('keyup.'+this.propertyName,function(){j._checkLength($(this))});this._optionPlugin(c,d)},_optionPlugin:function(a,b,c){a=$(a);var
d=a.data(this.propertyName);if(!b||(typeof b=='string'&&c==null)){var e=b;b=(d||{}).options;return(b&&e?b[e]:b)}if(!a.hasClass(this.markerClassName)){return}b=b||{};if(typeof
b=='string'){var e=b;b={};b[e]=c}$.extend(d.options,b);if(d.feedbackTarget.length>0){if(d.hadFeedbackTarget){d.feedbackTarget.empty().val('').removeClass(this._feedbackClass+'
'+this._fullClass+' '+this._overflowClass)}else{d.feedbackTarget.remove()}d.feedbackTarget=$([])}if(d.options.showFeedback){d.hadFeedbackTarget=!!d.options.feedbackTarget;if($.isFunction(d.options.feedbackTarget)){d.feedbackTarget=d.options.feedbackTarget.apply(a[0],[])}else
if(d.options.feedbackTarget){d.feedbackTarget=$(d.options.feedbackTarget)}else{d.feedbackTarget=$('<span></span>').insertAfter(a)}d.feedbackTarget.addClass(this._feedbackClass)}a.unbind('mouseover
 .'+this.propertyName+' focus.'+this.propertyName+'mouseout.'+this.propertyName+' blur.'+this.propertyName);if(d.options.showFeedback=='active'){a.bind('mouseover.'+this.propertyName,function(){d.feedbackTarget.css('visibility','visible')}).bind('mouseout.'+this.propertyName,function(){if(!d.focussed){d.feedbackTarget.css('visibility','hidden')}}).bind('focus.'+this.propertyName,function(){d.focussed=true;d.feedbackTarget.css('visibility','visible')}).bind('blur.'+this.propertyName,function(){d.focussed=false;d.feedbackTarget.css('visibility','hidden')});d.feedbackTarget.css('visibility','hidden')}this._checkLength(a)},_curLengthPlugin:function(a){var
b=a.data(this.propertyName);var c=a.val();var d=c.replace(/\r\n/g,'~~').replace(/\n/g,'~~').length;return{used:d,remaining:b.options.max-d}},_checkLength:function(a){var
b=a.data(this.propertyName);var c=a.val();var d=c.replace(/\r\n/g,'~~').replace(/\n/g,'~~').length;a.toggleClass(this._fullClass,d>=b.options.max).toggleClass(this._ove
 rflowClass,d>b.options.max);if(d>b.options.max&&b.options.truncate){var f=a.val().split(/\r\n|\n/);c='';var
i=0;while(c.length<b.options.max&&i<f.length){c+=f[i].substring(0,b.options.max-c.length)+'\r\n';i++}a.val(c.substring(0,b.options.max));a[0].scrollTop=a[0].scrollHeight;d=b.options.max}b.feedbackTarget.toggleClass(this._fullClass,d>=b.options.max).toggleClass(this._overflowClass,d>b.options.max);var
g=(d>b.options.max?b.options.overflowText:b.options.feedbackText).replace(/\{c\}/,d).replace(/\{m\}/,b.options.max).replace(/\{r\}/,b.options.max-d).replace(/\{o\}/,d-b.options.max);try{b.feedbackTarget.text(g)}catch(e){}try{b.feedbackTarget.val(g)}catch(e){}if(d>=b.options.max&&$.isFunction(b.options.onFull)){b.options.onFull.apply(a,[d>b.options.max])}},_enablePlugin:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.prop('disabled',false).removeClass(this.propertyName+'-disabled');var
b=a.data(this.propertyName);b.feedbackTarget.removeClass(this.propertyName+'-di
 sabled')},_disablePlugin:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.prop('disabled',true).addClass(this.propertyName+'-disabled');var
b=a.data(this.propertyName);b.feedbackTarget.addClass(this.propertyName+'-disabled')},_destroyPlugin:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}var
b=a.data(this.propertyName);if(b.feedbackTarget.length>0){if(b.hadFeedbackTarget){b.feedbackTarget.empty().val('').css('visibility','visible').removeClass(this._feedbackClass+'
'+this._fullClass+' '+this._overflowClass)}else{b.feedbackTarget.remove()}}a.removeClass(this.markerClassName+'
'+this._fullClass+' '+this._overflowClass).removeData(this.propertyName).unbind('.'+this.propertyName)}});var
h=['curLength'];function isNotChained(a,b){if(a=='option'&&(b.length==0||(b.length==1&&typeof
b[0]=='string'))){return true}return $.inArray(a,h)>-1}$.fn.maxlength=function(a){var b=Array.prototype.slice.call(arguments,1);if(isNotChained(a,b)){return
j['_'+a+'Plugin'].app
 ly(j,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){if(!j['_'+a+'Plugin']){throw'Unknown
method: '+a;}j['_'+a+'Plugin'].apply(j,[this].concat(b))}else{j._attachPlugin(this,a||{})}})};var
j=$.maxlength=new MaxLength()})(jQuery);
\ No newline at end of file


Mime
View raw message