mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-16 08:45:57 +00:00
upgrade Dojo to 1.6.1
This commit is contained in:
@@ -1,59 +1,168 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit.ProgressBar"]){
|
||||
dojo._hasResource["dijit.ProgressBar"]=true;
|
||||
if(!dojo._hasResource["dijit.ProgressBar"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit.ProgressBar"] = true;
|
||||
dojo.provide("dijit.ProgressBar");
|
||||
dojo.require("dojo.fx");
|
||||
dojo.require("dojo.number");
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.declare("dijit.ProgressBar",[dijit._Widget,dijit._Templated],{progress:"0",maximum:100,places:0,indeterminate:false,name:"",templateString:dojo.cache("dijit","templates/ProgressBar.html","<div class=\"dijitProgressBar dijitProgressBarEmpty\"\n\t><div waiRole=\"progressbar\" dojoAttachPoint=\"internalProgress\" class=\"dijitProgressBarFull\"\n\t\t><div class=\"dijitProgressBarTile\"></div\n\t\t><span style=\"visibility:hidden\"> </span\n\t></div\n\t><div dojoAttachPoint=\"label\" class=\"dijitProgressBarLabel\" id=\"${id}_label\"> </div\n\t><img dojoAttachPoint=\"indeterminateHighContrastImage\" class=\"dijitProgressBarIndeterminateHighContrastImage\" alt=\"\"\n/></div>\n"),_indeterminateHighContrastImagePath:dojo.moduleUrl("dijit","themes/a11y/indeterminate_progress.gif"),postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.indeterminateHighContrastImage.setAttribute("src",this._indeterminateHighContrastImagePath.toString());
|
||||
this.update();
|
||||
},update:function(_1){
|
||||
dojo.mixin(this,_1||{});
|
||||
var _2=this.internalProgress;
|
||||
var _3=1,_4;
|
||||
if(this.indeterminate){
|
||||
_4="addClass";
|
||||
dijit.removeWaiState(_2,"valuenow");
|
||||
dijit.removeWaiState(_2,"valuemin");
|
||||
dijit.removeWaiState(_2,"valuemax");
|
||||
}else{
|
||||
_4="removeClass";
|
||||
if(String(this.progress).indexOf("%")!=-1){
|
||||
_3=Math.min(parseFloat(this.progress)/100,1);
|
||||
this.progress=_3*this.maximum;
|
||||
}else{
|
||||
this.progress=Math.min(this.progress,this.maximum);
|
||||
_3=this.progress/this.maximum;
|
||||
}
|
||||
var _5=this.report(_3);
|
||||
this.label.firstChild.nodeValue=_5;
|
||||
dijit.setWaiState(_2,"describedby",this.label.id);
|
||||
dijit.setWaiState(_2,"valuenow",this.progress);
|
||||
dijit.setWaiState(_2,"valuemin",0);
|
||||
dijit.setWaiState(_2,"valuemax",this.maximum);
|
||||
}
|
||||
dojo[_4](this.domNode,"dijitProgressBarIndeterminate");
|
||||
_2.style.width=(_3*100)+"%";
|
||||
this.onChange();
|
||||
},_setValueAttr:function(v){
|
||||
if(v==Infinity){
|
||||
this.update({indeterminate:true});
|
||||
}else{
|
||||
this.update({indeterminate:false,progress:v});
|
||||
}
|
||||
},_getValueAttr:function(){
|
||||
return this.progress;
|
||||
},report:function(_6){
|
||||
return dojo.number.format(_6,{type:"percent",places:this.places,locale:this.lang});
|
||||
},onChange:function(){
|
||||
}});
|
||||
|
||||
|
||||
dojo.declare("dijit.ProgressBar", [dijit._Widget, dijit._Templated], {
|
||||
// summary:
|
||||
// A progress indication widget, showing the amount completed
|
||||
// (often the percentage completed) of a task.
|
||||
//
|
||||
// example:
|
||||
// | <div dojoType="ProgressBar"
|
||||
// | places="0"
|
||||
// | value="..." maximum="...">
|
||||
// | </div>
|
||||
|
||||
// progress: [const] String (Percentage or Number)
|
||||
// Number or percentage indicating amount of task completed.
|
||||
// Deprecated. Use "value" instead.
|
||||
progress: "0",
|
||||
|
||||
// value: String (Percentage or Number)
|
||||
// Number or percentage indicating amount of task completed.
|
||||
// With "%": percentage value, 0% <= progress <= 100%, or
|
||||
// without "%": absolute value, 0 <= progress <= maximum.
|
||||
// Infinity means that the progress bar is indeterminate.
|
||||
value: "",
|
||||
|
||||
// maximum: [const] Float
|
||||
// Max sample number
|
||||
maximum: 100,
|
||||
|
||||
// places: [const] Number
|
||||
// Number of places to show in values; 0 by default
|
||||
places: 0,
|
||||
|
||||
// indeterminate: [const] Boolean
|
||||
// If false: show progress value (number or percentage).
|
||||
// If true: show that a process is underway but that the amount completed is unknown.
|
||||
// Deprecated. Use "value" instead.
|
||||
indeterminate: false,
|
||||
|
||||
// label: String?
|
||||
// Label on progress bar. Defaults to percentage for determinate progress bar and
|
||||
// blank for indeterminate progress bar.
|
||||
label:"",
|
||||
|
||||
// name: String
|
||||
// this is the field name (for a form) if set. This needs to be set if you want to use
|
||||
// this widget in a dijit.form.Form widget (such as dijit.Dialog)
|
||||
name: '',
|
||||
|
||||
templateString: dojo.cache("dijit", "templates/ProgressBar.html", "<div class=\"dijitProgressBar dijitProgressBarEmpty\" role=\"progressbar\"\n\t><div dojoAttachPoint=\"internalProgress\" class=\"dijitProgressBarFull\"\n\t\t><div class=\"dijitProgressBarTile\" role=\"presentation\"></div\n\t\t><span style=\"visibility:hidden\"> </span\n\t></div\n\t><div dojoAttachPoint=\"labelNode\" class=\"dijitProgressBarLabel\" id=\"${id}_label\"></div\n\t><img dojoAttachPoint=\"indeterminateHighContrastImage\" class=\"dijitProgressBarIndeterminateHighContrastImage\" alt=\"\"\n/></div>\n"),
|
||||
|
||||
// _indeterminateHighContrastImagePath: [private] dojo._URL
|
||||
// URL to image to use for indeterminate progress bar when display is in high contrast mode
|
||||
_indeterminateHighContrastImagePath:
|
||||
dojo.moduleUrl("dijit", "themes/a11y/indeterminate_progress.gif"),
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited(arguments);
|
||||
if(!("value" in this.params)){
|
||||
this.value = this.indeterminate ? Infinity : this.progress;
|
||||
}
|
||||
},
|
||||
|
||||
buildRendering: function(){
|
||||
this.inherited(arguments);
|
||||
this.indeterminateHighContrastImage.setAttribute("src",
|
||||
this._indeterminateHighContrastImagePath.toString());
|
||||
this.update();
|
||||
},
|
||||
|
||||
update: function(/*Object?*/attributes){
|
||||
// summary:
|
||||
// Internal method to change attributes of ProgressBar, similar to set(hash). Users should call
|
||||
// set("value", ...) rather than calling this method directly.
|
||||
// attributes:
|
||||
// May provide progress and/or maximum properties on this parameter;
|
||||
// see attribute specs for details.
|
||||
// example:
|
||||
// | myProgressBar.update({'indeterminate': true});
|
||||
// | myProgressBar.update({'progress': 80});
|
||||
// | myProgressBar.update({'indeterminate': true, label:"Loading ..." })
|
||||
// tags:
|
||||
// private
|
||||
|
||||
// TODO: deprecate this method and use set() instead
|
||||
|
||||
dojo.mixin(this, attributes || {});
|
||||
var tip = this.internalProgress, ap = this.domNode;
|
||||
var percent = 1;
|
||||
if(this.indeterminate){
|
||||
dijit.removeWaiState(ap, "valuenow");
|
||||
dijit.removeWaiState(ap, "valuemin");
|
||||
dijit.removeWaiState(ap, "valuemax");
|
||||
}else{
|
||||
if(String(this.progress).indexOf("%") != -1){
|
||||
percent = Math.min(parseFloat(this.progress)/100, 1);
|
||||
this.progress = percent * this.maximum;
|
||||
}else{
|
||||
this.progress = Math.min(this.progress, this.maximum);
|
||||
percent = this.progress / this.maximum;
|
||||
}
|
||||
|
||||
dijit.setWaiState(ap, "describedby", this.labelNode.id);
|
||||
dijit.setWaiState(ap, "valuenow", this.progress);
|
||||
dijit.setWaiState(ap, "valuemin", 0);
|
||||
dijit.setWaiState(ap, "valuemax", this.maximum);
|
||||
}
|
||||
this.labelNode.innerHTML = this.report(percent);
|
||||
|
||||
dojo.toggleClass(this.domNode, "dijitProgressBarIndeterminate", this.indeterminate);
|
||||
tip.style.width = (percent * 100) + "%";
|
||||
this.onChange();
|
||||
},
|
||||
|
||||
_setValueAttr: function(v){
|
||||
this._set("value", v);
|
||||
if(v == Infinity){
|
||||
this.update({indeterminate:true});
|
||||
}else{
|
||||
this.update({indeterminate:false, progress:v});
|
||||
}
|
||||
},
|
||||
|
||||
_setLabelAttr: function(label){
|
||||
this._set("label", label);
|
||||
this.update();
|
||||
},
|
||||
|
||||
_setIndeterminateAttr: function(indeterminate){
|
||||
// Deprecated, use set("value", ...) instead
|
||||
this.indeterminate = indeterminate;
|
||||
this.update();
|
||||
},
|
||||
|
||||
report: function(/*float*/percent){
|
||||
// summary:
|
||||
// Generates message to show inside progress bar (normally indicating amount of task completed).
|
||||
// May be overridden.
|
||||
// tags:
|
||||
// extension
|
||||
|
||||
return this.label ? this.label :
|
||||
(this.indeterminate ? " " : dojo.number.format(percent, { type: "percent", places: this.places, locale: this.lang }));
|
||||
},
|
||||
|
||||
onChange: function(){
|
||||
// summary:
|
||||
// Callback fired when progress updates.
|
||||
// tags:
|
||||
// extension
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user