Remove trunk directory
This commit is contained in:
101
wise-webapp/src/main/webapp/js/IconPanel.js
Normal file
101
wise-webapp/src/main/webapp/js/IconPanel.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var IconPanel = new Class({
|
||||
options:{
|
||||
width:190,
|
||||
initialWidth:0,
|
||||
height:145,
|
||||
content:null,
|
||||
panel:null,
|
||||
button:null,
|
||||
onStart:Class.empty,
|
||||
state:'close'
|
||||
},
|
||||
initialize:function(options){
|
||||
this.setOptions(options);
|
||||
if($chk(this.options.button))
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
setButton:function(button){
|
||||
this.options.button=button;
|
||||
},
|
||||
init:function(){
|
||||
var panel = new Element('div');
|
||||
var coord = this.options.button.getCoordinates();
|
||||
var top = this.options.button.getTop() + coord.height+2;
|
||||
var left = this.options.button.getLeft();
|
||||
panel.setStyles({width:this.options.initialWidth, height:0,position:'absolute', top:top, left:left, background:'#e5e5e5', border:'1px solid #BBB4D6', zIndex:20, overflow:'hidden'});
|
||||
this.options.panel=panel;
|
||||
this.options.content.inject(panel);
|
||||
|
||||
this.options.content.addEvent('click', function(event) {
|
||||
this.close();
|
||||
}.bind(this));
|
||||
panel.setStyle('opacity',0);
|
||||
panel.inject($(document.body));
|
||||
this.registerOpenPanel();
|
||||
},
|
||||
open:function(){
|
||||
if(this.options.state=='close')
|
||||
{
|
||||
if(!$chk(this.options.panel))
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
var panel = this.options.panel;
|
||||
var options = this.options;
|
||||
panel.setStyles({border: '1px solid #636163', opacity:100});
|
||||
this.fireEvent('onStart');
|
||||
var fx = panel.effects({duration:500, onComplete:function(){
|
||||
this.registerClosePanel();
|
||||
}.bind(this)});
|
||||
fx.start({'height':[0,this.options.height], 'width':[this.options.initialWidth, this.options.width]});
|
||||
this.options.state='open';
|
||||
|
||||
}
|
||||
},
|
||||
close:function(){
|
||||
if(this.options.state=='open')
|
||||
{
|
||||
var fx = this.options.panel.effects({duration:500, onComplete:function(){
|
||||
this.options.panel.setStyles({border: '1px solid transparent', opacity:0});
|
||||
this.registerOpenPanel();
|
||||
}.bind(this)});
|
||||
fx.start({'height':[this.options.height,0], 'width':[this.options.width, this.options.initialWidth]});
|
||||
this.options.state = 'close';
|
||||
}
|
||||
},
|
||||
registerOpenPanel:function(){
|
||||
this.options.button.removeEvents('click');
|
||||
this.options.button.addEvent('click',function(event){
|
||||
this.open();
|
||||
}.bindWithEvent(this));
|
||||
},
|
||||
registerClosePanel:function(){
|
||||
this.options.button.removeEvents('click');
|
||||
this.options.button.addEvent('click', function(event){
|
||||
this.close();
|
||||
}.bindWithEvent(this));
|
||||
}
|
||||
});
|
||||
|
||||
IconPanel.implement(new Events, new Options);
|
||||
413
wise-webapp/src/main/webapp/js/common.js
Normal file
413
wise-webapp/src/main/webapp/js/common.js
Normal file
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/******************************************************************/
|
||||
/* MOOdalBox 1.3.b4 */
|
||||
/* A modal box (inline popup), used to display remote content */
|
||||
/* loaded using AJAX, written for the mootools framework */
|
||||
/* by Razvan Brates, razvan [at] e-magine.ro */
|
||||
/******************************************************************/
|
||||
/* http://www.e-magine.ro/moodalbox */
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* MIT style license: */
|
||||
/* http://en.wikipedia.org/wiki/MIT_License */
|
||||
/* */
|
||||
/* mootools found at: */
|
||||
/* http://mootools.net/ */
|
||||
/* */
|
||||
/* Original code based on "Slimbox", by Christophe Beyls: */
|
||||
/* http://www.digitalia.be/software/slimbox */
|
||||
/******************************************************************/
|
||||
|
||||
// Constants defined here can be changed for easy config / translation
|
||||
// (defined as vars, because of MSIE's lack of support for const)
|
||||
|
||||
var _ERROR_MESSAGE = "Oops.. there was a problem with your request.<br /><br />" +
|
||||
"Please try again.<br /><br />" +
|
||||
"<em>Click anywhere to close.</em>";
|
||||
// the error message displayed when the request has a problem
|
||||
var _RESIZE_DURATION = 400;
|
||||
// Duration of height and width resizing (ms)
|
||||
var _INITIAL_WIDTH = 250;
|
||||
// Initial width of the box (px)
|
||||
var _INITIAL_HEIGHT = 250;
|
||||
// Initial height of the box (px)
|
||||
var _CONTENTS_WIDTH = 500;
|
||||
// Actual width of the box (px)
|
||||
var _CONTENTS_HEIGHT = 400;
|
||||
// Actual height of the box (px)
|
||||
var _DEF_CONTENTS_WIDTH = 500;
|
||||
// Default width of the box (px) - used for resetting when a different setting was used
|
||||
var _DEF_CONTENTS_HEIGHT = 400;
|
||||
// Default height of the box (px) - used for resetting when a different setting was used
|
||||
var _DEF_FULLSCREEN_WIDTH = 0.95;
|
||||
// Default fullscreen width (%)
|
||||
var _DEF_FULLSCREEN_HEIGHT = 0.8;
|
||||
// Default fullscreen height (%)
|
||||
var _ANIMATE_CAPTION = true;
|
||||
// Enable/Disable caption animation
|
||||
var _EVAL_SCRIPTS = true;
|
||||
// Option to evaluate scripts in the response text
|
||||
var _EVAL_RESPONSE = false;
|
||||
// Option to evaluate the whole response text
|
||||
|
||||
// The MOOdalBox object in its beauty
|
||||
var MOOdalBox = {
|
||||
|
||||
// init the MOOdalBox
|
||||
init: function (options) {
|
||||
|
||||
// init default options
|
||||
this.options = Object.extend({
|
||||
resizeDuration: _RESIZE_DURATION,
|
||||
initialWidth: _INITIAL_WIDTH,
|
||||
initialHeight: _INITIAL_HEIGHT,
|
||||
contentsWidth: _CONTENTS_WIDTH,
|
||||
contentsHeight: _CONTENTS_HEIGHT,
|
||||
defContentsWidth: _DEF_CONTENTS_WIDTH,
|
||||
defContentsHeight: _DEF_CONTENTS_HEIGHT,
|
||||
defFullscreenWidth: _DEF_FULLSCREEN_WIDTH,
|
||||
defFullscreenHeight:_DEF_FULLSCREEN_HEIGHT,
|
||||
animateCaption: _ANIMATE_CAPTION,
|
||||
evalScripts: _EVAL_SCRIPTS,
|
||||
evalResponse: _EVAL_RESPONSE
|
||||
}, options || {});
|
||||
|
||||
// scan anchors for those opening a MOOdalBox
|
||||
this.anchors = [];
|
||||
this.scanAnchors(document.body, false);
|
||||
// scan forms for those opening a MOOdalBox
|
||||
this.forms = [];
|
||||
this.scanForms(document.body, false);
|
||||
// add event listeners
|
||||
this.eventKeyDown = this.keyboardListener.bindWithEvent(this);
|
||||
this.eventPosition = this.position.bind(this);
|
||||
|
||||
// init the HTML elements
|
||||
// the overlay (clickable to close)
|
||||
this.overlay = new Element('div').setProperty('id', 'mb_overlay').injectInside(document.body);
|
||||
|
||||
this.overlayDiv = new Element('div').setOpacity(0).setStyles({position: 'absolute', border: 0, width: '100%', backgroundColor: "black", zIndex: 98}).injectInside(document.body);
|
||||
// the center element
|
||||
this.center = new Element('div').setProperty('id', 'mb_center').setStyles({width: this.options.initialWidth + 'px', height: this.options.initialHeight + 'px', marginLeft: '-' + (this.options.initialWidth / 2) + 'px', display: 'none'}).injectInside(document.body);
|
||||
// the actual page contents
|
||||
this.contents = new Element('div').setProperty('id', 'mb_contents').injectInside(this.center);
|
||||
|
||||
// the bottom part (caption / close)
|
||||
this.bottom = new Element('div').setProperty('id', 'mb_bottom').setStyle('display', 'none').injectInside(document.body);
|
||||
this.closelink = new Element('a').setProperties({id: 'mb_close_link', href: '#'}).injectInside(this.bottom);
|
||||
this.caption = new Element('div').setProperty('id', 'mb_caption').injectInside(this.bottom);
|
||||
new Element('div').setStyle('clear', 'both').injectInside(this.bottom);
|
||||
|
||||
this.error = new Element('div').setProperty('id', 'mb_error').setHTML(_ERROR_MESSAGE);
|
||||
|
||||
// attach the close event to the close button / the overlay
|
||||
this.closelink.onclick = this.overlay.onclick = this.close.bind(this);
|
||||
|
||||
// init the effects
|
||||
var nextEffect = this.nextEffect.bind(this);
|
||||
this.fx = {
|
||||
overlay: this.overlay.effect('opacity', { duration: 500 }).hide(),
|
||||
resize: this.center.effects({ onComplete: nextEffect }),
|
||||
contents: this.contents.effect('opacity', { duration: 500, onComplete: nextEffect }),
|
||||
bottom: this.bottom.effects({ duration: 400, onComplete: nextEffect })
|
||||
};
|
||||
|
||||
// AJAX related options
|
||||
var ajaxFailure = this.ajaxFailure.bind(this);
|
||||
this.ajaxOptions = {
|
||||
update: this.contents,
|
||||
evalScripts: this.options.evalScripts,
|
||||
evalResponse: this.options.evalResponse,
|
||||
onComplete: nextEffect,
|
||||
onFailure: ajaxFailure,
|
||||
encoding: 'utf-8'
|
||||
};
|
||||
|
||||
this.ajaxRequest = Class.empty;
|
||||
|
||||
},
|
||||
|
||||
click: function(link) {
|
||||
return this.open(link.href, link.title, link.rel, false);
|
||||
},
|
||||
|
||||
open: function(sLinkHref, sLinkTitle, sLinkRel, oForm) {
|
||||
//Remove window key event listeners.
|
||||
this.eventContainer = new Element('div');
|
||||
this.eventContainer.cloneEvents($(document), 'keydown');
|
||||
$(document).removeEvents('keydown');
|
||||
|
||||
this.href = sLinkHref;
|
||||
this.title = sLinkTitle;
|
||||
this.rel = sLinkRel;
|
||||
|
||||
if (oForm) {
|
||||
if (oForm.method == 'get') {
|
||||
this.href += "?" + oForm.toQueryString();
|
||||
this.ajaxOptions = Object.extend(this.ajaxOptions, {method: 'get', postBody: ''});
|
||||
} else {
|
||||
this.ajaxOptions = Object.extend(this.ajaxOptions, {method: 'post', postBody: oForm});
|
||||
}
|
||||
} else {
|
||||
this.ajaxOptions = Object.extend(this.ajaxOptions, {method: 'get', postBody: ''});
|
||||
}
|
||||
this.ajaxOptions.encoding = 'utf-8';
|
||||
|
||||
this.position();
|
||||
this.setup(true);
|
||||
this.top = Window.getScrollTop() + (Window.getHeight() / 15);
|
||||
this.center.setStyles({top: this.top + 'px', display: ''});
|
||||
this.fx.overlay.custom(0.8);
|
||||
return this.loadContents(sLinkHref);
|
||||
},
|
||||
|
||||
position: function() {
|
||||
this.overlay.setStyles({top: Window.getScrollTop() + 'px', height: Window.getHeight() + 'px'});
|
||||
this.overlayDiv.setStyles({top: Window.getScrollTop() + 'px', height: Window.getHeight() + 'px'});
|
||||
},
|
||||
|
||||
scanAnchors: function(oWhere, bForce) {
|
||||
|
||||
// scan anchors for those opening a MOOdalBox
|
||||
$$($(oWhere).getElements('a')).each(function(el) {
|
||||
// we use a regexp to check for links that
|
||||
// have a rel attribute starting with "moodalbox"
|
||||
if (el.href && ((el.rel && el.rel.test('^moodalbox', 'i')) || (bForce && !el.onclick))) {
|
||||
if (bForce && !el.rel) {
|
||||
// if we're forcing links to open in a moodalbox, we're keeping the current size
|
||||
el.rel = "moodalbox " + this.options.contentsWidth + "px " + this.options.contentsHeight + "px";
|
||||
if (this.wizardMode) el.rel += " wizard";
|
||||
}
|
||||
el.onclick = this.click.pass(el, this);
|
||||
this.anchors.push(el);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
scanForms: function (oWhere, bForce) {
|
||||
// scan forms for those opening a MOOdalBox
|
||||
$$($(oWhere).getElements('form')).each(function(el) {
|
||||
// we use a regexp to check for links that
|
||||
// have a rel attribute starting with "moodalbox"
|
||||
el.rel = el.getProperty('rel');
|
||||
if ((el.rel && el.rel.test('^moodalbox', 'i')) || bForce) {
|
||||
if (bForce && !el.rel) {
|
||||
// if we're forcing links to open in a moodalbox, we're keeping the current size
|
||||
el.rel = "moodalbox " + this.options.contentsWidth + "px " + this.options.contentsHeight + "px";
|
||||
if (this.wizardMode) el.rel += " wizard";
|
||||
}
|
||||
el.onsubmit = this.open.pass([el.action, el.title, el.rel, el], this);
|
||||
this.forms.push(el);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
setup: function(open) {
|
||||
//var elements = $A($$('object'));
|
||||
//elements.extend($$(window.ActiveXObject ? 'select' : 'embed'));
|
||||
//elements.each(function(el){ el.style.visibility = open ? 'hidden' : ''; });
|
||||
|
||||
// use an iframe to show under everything
|
||||
|
||||
var fn = open ? 'addEvent' : 'removeEvent';
|
||||
window[fn]('scroll', this.eventPosition)[fn]('resize', this.eventPosition);
|
||||
document[fn]('keydown', this.eventKeyDown);
|
||||
this.step = 0;
|
||||
},
|
||||
|
||||
loadContents: function() {
|
||||
|
||||
if (this.step) return false;
|
||||
this.step = 1;
|
||||
|
||||
// check to see if there are specified dimensions
|
||||
// if not, fall back to default values
|
||||
|
||||
// fullscreen switch concept originally by Lennart Pilon (http://ljpilon.nl/)
|
||||
|
||||
// we check for a "fullscreen" switch
|
||||
if (this.rel.test("fullscreen")) {
|
||||
|
||||
this.options.contentsWidth = this.options.defFullscreenWidth * window.getWidth();
|
||||
this.options.contentsHeight = this.options.defFullscreenHeight * window.getHeight();
|
||||
|
||||
} else { // we check for other specified dimensions (px or %)
|
||||
|
||||
var aDim = this.rel.match(/[0-9.]+(px|%)/g);
|
||||
|
||||
if (aDim && aDim[0]) { //first dimension is interpreted as width
|
||||
|
||||
var w = aDim[0].toInt();
|
||||
|
||||
if (aDim[0].test("%")) {
|
||||
this.options.contentsWidth = (w > 0) ? 0.01 * w * window.getWidth() : this.options.defFullscreenWidth * window.getWidth();
|
||||
} else {
|
||||
this.options.contentsWidth = (w > 0) ? w : this.options.defContentsWidth;
|
||||
}
|
||||
} else { // we switch to defaults if there aren't any dimensions specified
|
||||
this.options.contentsWidth = this.options.defContentsWidth;
|
||||
this.options.contentsHeight = this.options.defContentsHeight;
|
||||
}
|
||||
|
||||
if (aDim && aDim[1]) { // we have a second dimension specified, which we'll interpret as height
|
||||
|
||||
var h = aDim[1].toInt();
|
||||
|
||||
if (aDim[1].test("%")) {
|
||||
this.options.contentsHeight = (h > 0) ? 0.01 * h * window.getHeight() : this.options.defFullscreenHeight * window.getHeight();
|
||||
} else {
|
||||
this.options.contentsHeight = (h > 0) ? h : this.options.defContentsHeight;
|
||||
}
|
||||
} else if (aDim && aDim[0]) {
|
||||
// we have the first dimension specified, but not the second
|
||||
// so we interpret as width = height = the given value
|
||||
if (aDim[0].test("%")) {
|
||||
this.options.contentsHeight = (w > 0) ? 0.01 * w * window.getHeight() : this.options.defFullscreenHeight * window.getHeight();
|
||||
} else {
|
||||
this.options.contentsHeight = (w > 0) ? w : this.options.defContentsHeight;
|
||||
}
|
||||
}
|
||||
// correct a little approximation bug (size flickers)
|
||||
this.options.contentsWidth = Math.floor(this.options.contentsWidth);
|
||||
this.options.contentsHeight = Math.floor(this.options.contentsHeight);
|
||||
|
||||
}
|
||||
|
||||
this.wizardMode = this.rel.test("wizard");
|
||||
|
||||
// this is where we'll check for other options passed via the rel attribute
|
||||
|
||||
this.bottom.setStyles({opacity: '0', height: '0px', display: 'none'});
|
||||
this.center.className = 'mb_loading';
|
||||
|
||||
this.fx.contents.hide();
|
||||
|
||||
// AJAX call here
|
||||
this.ajaxRequest = new Ajax(this.href, this.ajaxOptions).request();
|
||||
|
||||
// make the local timeout call here
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
ajaxFailure: function () {
|
||||
this.contents.setHTML('');
|
||||
this.error.clone().injectInside(this.contents);
|
||||
this.nextEffect();
|
||||
this.center.setStyle('cursor', 'pointer');
|
||||
this.bottom.setStyle('cursor', 'pointer');
|
||||
this.center.onclick = this.bottom.onclick = this.close.bind(this);
|
||||
},
|
||||
|
||||
|
||||
// make the local timeout function here
|
||||
|
||||
|
||||
nextEffect: function() {
|
||||
switch (this.step++) {
|
||||
case 1:
|
||||
// remove previous styling from the elements
|
||||
// (e.g. styling applied in case of an error)
|
||||
this.center.className = '';
|
||||
this.center.setStyle('cursor', 'default');
|
||||
this.bottom.setStyle('cursor', 'default');
|
||||
this.center.onclick = this.bottom.onclick = '';
|
||||
this.caption.setHTML(this.title);
|
||||
|
||||
this.contents.setStyles({width: this.options.contentsWidth + "px", height: this.options.contentsHeight + "px"});
|
||||
|
||||
if (this.center.clientHeight != this.contents.offsetHeight) {
|
||||
this.fx.resize.options.duration = this.options.resizeDuration;
|
||||
this.fx.resize.custom({height: [this.center.clientHeight, this.contents.offsetHeight]});
|
||||
break;
|
||||
}
|
||||
this.step++;
|
||||
|
||||
|
||||
|
||||
case 2:
|
||||
if (this.center.clientWidth != this.contents.offsetWidth) {
|
||||
this.fx.resize.custom({width: [this.center.clientWidth, this.contents.offsetWidth], marginLeft: [-this.center.clientWidth / 2, -this.contents.offsetWidth / 2]});
|
||||
break;
|
||||
}
|
||||
this.step++;
|
||||
|
||||
case 3:
|
||||
this.bottom.setStyles({top: (this.top + this.center.clientHeight) + 'px', width: this.contents.style.width, marginLeft: this.center.style.marginLeft, display: ''});
|
||||
|
||||
// check to see if in wizard mode and parse links
|
||||
if (this.wizardMode) this.scanAnchors(this.contents, true);
|
||||
if (this.wizardMode) this.scanForms(this.contents, true);
|
||||
|
||||
this.fx.contents.custom(0, 1);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (this.options.animateCaption) {
|
||||
this.fx.bottom.custom({opacity: [0, 1], height: [0, this.bottom.scrollHeight]});
|
||||
break;
|
||||
}
|
||||
this.bottom.setStyles({opacity: '1', height: this.bottom.scrollHeight + 'px'});
|
||||
|
||||
case 5:
|
||||
this.step = 0;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
keyboardListener: function(event) {
|
||||
// close the MOOdalBox when the user presses CTRL + W, CTRL + X, ESC
|
||||
if ((event.control && event.key == 'w') || (event.control && event.key == 'x') || (event.key == 'esc')) {
|
||||
this.close();
|
||||
event.stop();
|
||||
}
|
||||
},
|
||||
|
||||
close: function() {
|
||||
//restore key event listeners
|
||||
$(document).cloneEvents(this.eventContainer, 'keydown');
|
||||
this.eventContainer.removeEvents('keydown');
|
||||
if (this.step < 0) return;
|
||||
this.step = -1;
|
||||
for (var f in this.fx) this.fx[f].clearTimer();
|
||||
this.center.style.display = this.bottom.style.display = 'none';
|
||||
this.center.className = 'mb_loading';
|
||||
this.fx.overlay.chain(this.setup.pass(false, this)).custom(0);
|
||||
this.overlayDiv.style.display = "none";
|
||||
return false;
|
||||
},
|
||||
|
||||
config: function(options) {
|
||||
this.options = Object.extend(this.options, options || {});
|
||||
return false;
|
||||
// to be used on links
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Moodal Dialog startup
|
||||
Window.onDomReady(MOOdalBox.init.bind(MOOdalBox));
|
||||
|
||||
|
||||
function displayLoading()
|
||||
{
|
||||
$('headerLoading').style.visibility = 'visible';
|
||||
}
|
||||
701
wise-webapp/src/main/webapp/js/editor.js
Normal file
701
wise-webapp/src/main/webapp/js/editor.js
Normal file
@@ -0,0 +1,701 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
|
||||
function afterCoreLoading()
|
||||
{
|
||||
|
||||
// Uncomment for debug ...
|
||||
if (core.UserAgent.isVMLSupported())
|
||||
{
|
||||
$import("../js/mindplot.vml.js");
|
||||
} else
|
||||
{
|
||||
$import("../js/mindplot.svg.js");
|
||||
}
|
||||
|
||||
// if (core.UserAgent.isVMLSupported())
|
||||
// {
|
||||
// $import("../js/mindplot.vml-min.js");
|
||||
// } else
|
||||
// {
|
||||
// $import("../js/mindplot.svg-min.js");
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
};
|
||||
afterCoreLoading();
|
||||
|
||||
|
||||
|
||||
/*Extend mootools known keys*/
|
||||
ExtendedKeys = {
|
||||
'insert': 45,
|
||||
'f2':113,
|
||||
'ctrl-enter':17
|
||||
};
|
||||
|
||||
$extend(Event.keys, ExtendedKeys);
|
||||
|
||||
var designer = null;
|
||||
/* JavaScript tabs changer */
|
||||
|
||||
// CSS helper functions
|
||||
CSS = {
|
||||
// Adds a class to an element.
|
||||
AddClass: function (e, c) {
|
||||
if (!e.className.match(new RegExp("\\b" + c + "\\b", "i")))
|
||||
e.className += (e.className ? " " : "") + c;
|
||||
},
|
||||
|
||||
// Removes a class from an element.
|
||||
RemoveClass: function (e, c) {
|
||||
e.className = e.className.replace(new RegExp(" \\b" + c + "\\b|\\b" + c + "\\b ?", "gi"), "");
|
||||
}
|
||||
};
|
||||
|
||||
// Functions for handling tabs.
|
||||
Tabs = {
|
||||
// Changes to the tab with the specified ID.
|
||||
GoTo: function (contentId, skipReplace) {
|
||||
// This variable will be true if a tab for the specified
|
||||
// content ID was found.
|
||||
var foundTab = false;
|
||||
|
||||
// Get the TOC element.
|
||||
var toc = $("toc");
|
||||
if (toc) {
|
||||
var lis = toc.getElementsByTagName("li");
|
||||
for (var j = 0; j < lis.length; j++) {
|
||||
var li = lis[j];
|
||||
|
||||
// Give the current tab link the class "current" and
|
||||
// remove the class from any other TOC links.
|
||||
var anchors = li.getElementsByTagName("a");
|
||||
var anchors = li.getElementsByTagName("a");
|
||||
for (var k = 0; k < anchors.length; k++) {
|
||||
if (anchors[k].hash == "#" + contentId) {
|
||||
CSS.AddClass(li, "current");
|
||||
foundTab = true;
|
||||
break;
|
||||
} else {
|
||||
CSS.RemoveClass(li, "current");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show the content with the specified ID.
|
||||
var divsToHide = [];
|
||||
var divs = document.getElementsByTagName("div");
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
var div = divs[i];
|
||||
|
||||
if (div.className.match(/\btabContent\b/i)) {
|
||||
if (div.id == "_" + contentId)
|
||||
div.style.display = "block";
|
||||
else
|
||||
{
|
||||
divsToHide.push(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the other content boxes.
|
||||
for (var i = 0; i < divsToHide.length; i++)
|
||||
divsToHide[i].style.display = "none";
|
||||
|
||||
// Change the address bar.
|
||||
if (!skipReplace) window.location.replace("#" + contentId);
|
||||
},
|
||||
|
||||
OnClickHandler: function (e) {
|
||||
// Stop the event (to stop it from scrolling or
|
||||
// making an entry in the history).
|
||||
if (!e) e = window.event;
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
|
||||
// Get the name of the anchor of the link that was clicked.
|
||||
Tabs.GoTo(this.hash.substring(1));
|
||||
},
|
||||
|
||||
Init: function () {
|
||||
if (!document.getElementsByTagName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Attach an onclick event to all the anchor links on the page.
|
||||
var anchors = document.getElementsByTagName("a");
|
||||
for (var i = 0; i < anchors.length; i++) {
|
||||
var a = anchors[i];
|
||||
if (a.hash) {
|
||||
a.onclick = Tabs.OnClickHandler;
|
||||
}
|
||||
}
|
||||
|
||||
var contentId;
|
||||
if (window.location.hash)
|
||||
contentId = window.location.hash.substring(1);
|
||||
|
||||
var divs = document.getElementsByTagName("div");
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
var div = divs[i];
|
||||
|
||||
if (div.className.match(/\btabContent\b/i)) {
|
||||
if (!contentId) contentId = div.id;
|
||||
div.id = "_" + div.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (contentId)
|
||||
Tabs.GoTo(contentId, true);
|
||||
}
|
||||
};
|
||||
|
||||
if (document.createStyleSheet) {
|
||||
var style = document.createStyleSheet();
|
||||
style.addRule("div.tabContent", "display: none;");
|
||||
style.addRule("div" + contentId, "display: block;");
|
||||
} else {
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
if (head) {
|
||||
var style = document.createElement("style");
|
||||
style.setAttribute("type", "text/css");
|
||||
style.appendChild(document.createTextNode("div.tabContent { display: none; }"));
|
||||
style.appendChild(document.createTextNode("div" + contentId + " { display: block; }"));
|
||||
head.appendChild(style);
|
||||
}
|
||||
}
|
||||
|
||||
// Hook up the OnLoad event to the tab initialization function.
|
||||
Tabs.Init();
|
||||
|
||||
// Hide the content while waiting for the onload event to trigger.
|
||||
var contentId = window.location.hash || "#Introduction";
|
||||
|
||||
var iconPanel = null;
|
||||
|
||||
function afterMindpotLibraryLoading()
|
||||
{
|
||||
buildMindmapDesigner();
|
||||
|
||||
if ($('helpButton') != null)
|
||||
{
|
||||
var helpPanel = new Panel({panelButton:$('helpButton'), backgroundColor:'black'});
|
||||
helpPanel.setContent(Help.buildHelp(helpPanel));
|
||||
}
|
||||
|
||||
if ($('helpButtonFirstSteps') != null)
|
||||
{
|
||||
var firstStepsPanel = $('helpButtonFirstSteps')
|
||||
firstStepsPanel.addEvent('click', function(event) {
|
||||
var firstStepWindow = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
|
||||
firstStepWindow.focus();
|
||||
firstStepWindow.moveTo(0, 0);
|
||||
firstStepWindow.resizeTo(screen.availWidth, screen.availHeight);
|
||||
});
|
||||
|
||||
var keyboardPanel = $('helpButtonKeyboard')
|
||||
keyboardPanel.addEvent('click', function(event) {
|
||||
MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
var iconChooser = buildIconChooser();
|
||||
iconPanel = new IconPanel({button:$('topicIcon'), onStart:cleanScreenEvent, content:iconChooser});
|
||||
// Register Events ...
|
||||
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||
$("ffoxWorkarroundInput").addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||
//
|
||||
$('zoomIn').addEvent('click', function(event) {
|
||||
designer.zoomIn();
|
||||
});
|
||||
|
||||
$('zoomOut').addEvent('click', function(event) {
|
||||
designer.zoomOut();
|
||||
});
|
||||
|
||||
$('undoEdition').addEvent('click', function(event) {
|
||||
designer.undo();
|
||||
});
|
||||
|
||||
$('redoEdition').addEvent('click', function(event) {
|
||||
designer.redo();
|
||||
});
|
||||
designer.addEventListener("change", function(event) {
|
||||
if (event.undoSteps > 0)
|
||||
{
|
||||
$("undoEdition").setStyle("background-image", "url(../images/file_undo.png)");
|
||||
} else
|
||||
{
|
||||
$("undoEdition").setStyle("background-image", "url(../images/file_undo_dis.png)");
|
||||
}
|
||||
|
||||
if (event.redoSteps > 0)
|
||||
{
|
||||
$("redoEdition").setStyle("background-image", "url(../images/file_redo.png)");
|
||||
} else
|
||||
{
|
||||
$("redoEdition").setStyle("background-image", "url(../images/file_redo_dis.png)");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('addTopic').addEvent('click', function(event) {
|
||||
designer.createSiblingForSelectedNode();
|
||||
});
|
||||
$('deleteTopic').addEvent('click', function(event) {
|
||||
var topics = designer.getSelectedNodes();
|
||||
designer.deleteCurrentNode();
|
||||
});
|
||||
var context = this;
|
||||
var colorPicker1 = new MooRainbow('topicColor', {
|
||||
id: 'topicColor',
|
||||
imgPath: '../images/',
|
||||
startColor: [255, 255, 255],
|
||||
onInit: function(color) {
|
||||
cleanScreenEvent.bind(context).attempt();
|
||||
setCurrentColorPicker.attempt(colorPicker1, context);
|
||||
},
|
||||
onChange: function(color) {
|
||||
designer.setBackColor2SelectedNode(color.hex);
|
||||
},
|
||||
onComplete: function(color) {
|
||||
removeCurrentColorPicker.attempt(colorPicker1, context);
|
||||
}
|
||||
});
|
||||
var colorPicker2 = new MooRainbow('topicBorder', {
|
||||
id: 'topicBorder',
|
||||
imgPath: '../images/',
|
||||
startColor: [255, 255, 255],
|
||||
onInit: function(color) {
|
||||
cleanScreenEvent.bind(context).attempt();
|
||||
setCurrentColorPicker.attempt(colorPicker2, context);
|
||||
},
|
||||
onChange: function(color) {
|
||||
designer.setBorderColor2SelectedNode(color.hex);
|
||||
},
|
||||
onComplete: function(color) {
|
||||
removeCurrentColorPicker.attempt(colorPicker2, context);
|
||||
}
|
||||
});
|
||||
$('topicLink').addEvent('click', function(event) {
|
||||
designer.addLink2SelectedNode();
|
||||
|
||||
});
|
||||
|
||||
$('topicNote').addEvent('click', function(event) {
|
||||
designer.addNote2SelectedNode();
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('fontBold').addEvent('click', function(event) {
|
||||
designer.setWeight2SelectedNode();
|
||||
});
|
||||
|
||||
$('fontItalic').addEvent('click', function(event) {
|
||||
designer.setStyle2SelectedNode();
|
||||
});
|
||||
|
||||
var colorPicker3 = new MooRainbow('fontColor', {
|
||||
id: 'fontColor',
|
||||
imgPath: '../images/',
|
||||
startColor: [255, 255, 255],
|
||||
onInit: function(color) {
|
||||
cleanScreenEvent.bind(context).attempt();
|
||||
setCurrentColorPicker.attempt(colorPicker3, context);
|
||||
},
|
||||
onChange: function(color) {
|
||||
designer.setFontColor2SelectedNode(color.hex);
|
||||
},
|
||||
onComplete: function(color) {
|
||||
removeCurrentColorPicker.attempt(colorPicker3, context);
|
||||
}
|
||||
});
|
||||
|
||||
// Save event handler ....
|
||||
var saveButton = $('saveButton');
|
||||
saveButton.addEvent('click', function(event) {
|
||||
|
||||
if (!isTryMode)
|
||||
{
|
||||
saveButton.setStyle('cursor', 'wait');
|
||||
var saveFunc = function()
|
||||
{
|
||||
designer.save(function()
|
||||
{
|
||||
var monitor = core.Monitor.getInstance();
|
||||
monitor.logMessage('Save completed successfully');
|
||||
saveButton.setStyle('cursor', 'pointer');
|
||||
}, true);
|
||||
}
|
||||
saveFunc.delay(1);
|
||||
} else
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var discardButton = $('discardButton');
|
||||
discardButton.addEvent('click', function(event) {
|
||||
|
||||
if (!isTryMode)
|
||||
{
|
||||
displayLoading();
|
||||
window.document.location = "mymaps.htm";
|
||||
} else
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (isTryMode)
|
||||
{
|
||||
$('tagIt').addEvent('click', function(event)
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('shareIt').addEvent('click', function(event)
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('publishIt').addEvent('click', function(event)
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('history').addEvent('click', function(event)
|
||||
{
|
||||
new Windoo.Confirm('This option is not enabled in try mode. You must by signed in order to execute this action.',
|
||||
{
|
||||
'window': {theme:Windoo.Themes.wise,
|
||||
title:''
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Autosave ...
|
||||
if (!isTryMode)
|
||||
{
|
||||
var autosave = function() {
|
||||
|
||||
if (designer.needsSave())
|
||||
{
|
||||
designer.save(function()
|
||||
{
|
||||
var monitor = core.Monitor.getInstance();
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
autosave.periodical(30000);
|
||||
|
||||
// To prevent the user from leaving the page with changes ...
|
||||
window.onbeforeunload = function confirmExit()
|
||||
{
|
||||
if (designer.needsSave())
|
||||
{
|
||||
designer.save(null, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Build panels ...
|
||||
fontFamilyPanel();
|
||||
shapeTypePanel();
|
||||
fontSizePanel();
|
||||
|
||||
// If not problem has occured, I close the dialod ...
|
||||
var closeDialog = function(){
|
||||
|
||||
if(!window.hasUnexpectedErrors)
|
||||
{
|
||||
waitDialog.deactivate();
|
||||
}
|
||||
}.delay(500);
|
||||
}
|
||||
|
||||
function buildIconChooser() {
|
||||
var content = new Element('div').setStyles({width:230,height:240,padding:5});
|
||||
var count = 0;
|
||||
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1)
|
||||
{
|
||||
var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i];
|
||||
for (var j = 0; j < familyIcons.length; j = j + 1)
|
||||
{
|
||||
// Separate icons by line ...
|
||||
var familyContent;
|
||||
if ((count % 9) == 0)
|
||||
{
|
||||
familyContent = new Element('div').inject(content);
|
||||
}
|
||||
|
||||
|
||||
var iconId = familyIcons[j];
|
||||
var img = new Element('img').setStyles({width:16,height:16,padding:"0px 2px"}).inject(familyContent);
|
||||
img.id = iconId;
|
||||
img.src = mindplot.ImageIcon.prototype._getImageUrl(iconId);
|
||||
img.addEvent('click', function(event, id) {
|
||||
designer.addImage2SelectedNode(this.id);
|
||||
}.bindWithEvent(img));
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
function setCurrentColorPicker(colorPicker)
|
||||
{
|
||||
this.currentColorPicker = colorPicker;
|
||||
}
|
||||
|
||||
function removeCurrentColorPicker(colorPicker)
|
||||
{
|
||||
$clear(this.currentColorPicker);
|
||||
}
|
||||
|
||||
function buildMindmapDesigner()
|
||||
{
|
||||
|
||||
// Initialize message logger ...
|
||||
var monitor = new core.Monitor($('msgLoggerContainer'), $('msgLogger'));
|
||||
core.Monitor.setInstance(monitor);
|
||||
|
||||
var container = $('mindplot');
|
||||
|
||||
// Initialize Editor ...
|
||||
var persistantManager = new mindplot.PersistanceManager(window.MapEditorService);
|
||||
|
||||
var screenWidth = window.getWidth();
|
||||
var screenHeight = window.getHeight();
|
||||
|
||||
// Positionate node ...
|
||||
// header - footer
|
||||
screenHeight = screenHeight - 90 - 61;
|
||||
|
||||
// body margin ...
|
||||
editorProperties.width = screenWidth;
|
||||
editorProperties.height = screenHeight;
|
||||
|
||||
designer = new mindplot.MindmapDesigner(editorProperties, container, persistantManager);
|
||||
designer.loadFromXML(mapId, mapXml);
|
||||
|
||||
// If a node has focus, focus can be move to another node using the keys.
|
||||
designer._cleanScreen = cleanScreenEvent.bind(this);
|
||||
|
||||
|
||||
// Save map on load ....
|
||||
if (editorProperties.saveOnLoad)
|
||||
{
|
||||
var saveOnLoad = function() {
|
||||
designer.save(function() {
|
||||
}, false);
|
||||
}.delay(1000)
|
||||
}
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
function createColorPalette(container, onSelectFunction, event)
|
||||
{
|
||||
cleanScreenEvent();
|
||||
_colorPalette = new core.ColorPicker();
|
||||
_colorPalette.onSelect = function(color) {
|
||||
onSelectFunction.call(this, color);
|
||||
cleanScreenEvent();
|
||||
};
|
||||
|
||||
// dojo.event.kwConnect({srcObj: this._colorPalette,srcFunc:"onColorSelect",targetObj:this._colorPalette, targetFunc:"onSelect", once:true});
|
||||
var mouseCoords = core.Utils.getMousePosition(event);
|
||||
var colorPaletteElement = $("colorPalette");
|
||||
colorPaletteElement.setStyle('left', (mouseCoords.x - 80) + "px");
|
||||
colorPaletteElement.setStyle('display', "block");
|
||||
}
|
||||
;
|
||||
|
||||
function cleanScreenEvent()
|
||||
{
|
||||
if (this.currentColorPicker)
|
||||
{
|
||||
this.currentColorPicker.hide();
|
||||
}
|
||||
$("fontFamilyPanel").setStyle('display', "none");
|
||||
$("fontSizePanel").setStyle('display', "none");
|
||||
$("topicShapePanel").setStyle('display', "none");
|
||||
iconPanel.close();
|
||||
}
|
||||
|
||||
function fontFamilyPanel()
|
||||
{
|
||||
var supportedFonts = ['times','arial','tahoma','verdana'];
|
||||
var updateFunction = function(value)
|
||||
{
|
||||
value = value.charAt(0).toUpperCase() + value.substring(1, value.length);
|
||||
designer.setFont2SelectedNode(value);
|
||||
};
|
||||
|
||||
var onFocusValue = function(selectedNode)
|
||||
{
|
||||
return selectedNode.getFontFamily();
|
||||
};
|
||||
|
||||
buildPanel('fontFamily', 'fontFamilyPanel', supportedFonts, updateFunction, onFocusValue);
|
||||
}
|
||||
|
||||
function shapeTypePanel()
|
||||
{
|
||||
var shapeTypePanel = ['rectagle','rounded rectagle','line','elipse'];
|
||||
var updateFunction = function(value)
|
||||
{
|
||||
designer.setShape2SelectedNode(value);
|
||||
};
|
||||
|
||||
var onFocusValue = function(selectedNode)
|
||||
{
|
||||
return selectedNode.getShapeType();
|
||||
};
|
||||
|
||||
buildPanel('topicShape', 'topicShapePanel', shapeTypePanel, updateFunction, onFocusValue);
|
||||
}
|
||||
|
||||
function fontSizePanel()
|
||||
{
|
||||
var shapeTypePanel = ['small','normal','large','huge'];
|
||||
var map = {small:'6',normal:'8',large:'10',huge:'15'};
|
||||
var updateFunction = function(value)
|
||||
{
|
||||
var nodes = designer.getSelectedNodes();
|
||||
var value = map[value];
|
||||
designer.setFontSize2SelectedNode(value);
|
||||
};
|
||||
|
||||
var onFocusValue = function(selectedNode)
|
||||
{
|
||||
var fontSize = selectedNode.getFontSize();
|
||||
var result = "";
|
||||
if (fontSize <= 6)
|
||||
{
|
||||
result = 'small';
|
||||
} else if (fontSize <= 8)
|
||||
{
|
||||
result = 'normal';
|
||||
} else if (fontSize <= 10)
|
||||
{
|
||||
result = 'large';
|
||||
} else if (fontSize >= 15)
|
||||
{
|
||||
result = 'huge';
|
||||
}
|
||||
return result;
|
||||
};
|
||||
buildPanel('fontSize', 'fontSizePanel', shapeTypePanel, updateFunction, onFocusValue);
|
||||
}
|
||||
|
||||
function buildPanel(buttonElemId, elemLinksContainer, elemLinkIds, updateFunction, onFocusValue)
|
||||
{
|
||||
// Font family event handling ....
|
||||
$(buttonElemId).addEvent('click', function(event)
|
||||
{
|
||||
var container = $(elemLinksContainer);
|
||||
var isRendered = container.getStyle('display') == 'block';
|
||||
cleanScreenEvent();
|
||||
|
||||
// Restore default css.
|
||||
for (var i = 0; i < elemLinkIds.length; i++)
|
||||
{
|
||||
var elementId = elemLinkIds[i];
|
||||
$(elementId).className = 'toolbarPanelLink';
|
||||
}
|
||||
|
||||
// Select current element ...
|
||||
var nodes = designer.getSelectedNodes();
|
||||
var lenght = nodes.length;
|
||||
if (lenght == 1)
|
||||
{
|
||||
var selectedNode = nodes[0];
|
||||
var selectedElementId = onFocusValue(selectedNode);
|
||||
selectedElementId = selectedElementId.toLowerCase();
|
||||
var selectedElement = $(selectedElementId);
|
||||
selectedElement.className = 'toolbarPanelLinkSelectedLink';
|
||||
}
|
||||
|
||||
container.setStyle('display', 'block');
|
||||
|
||||
var mouseCoords = core.Utils.getMousePosition(event);
|
||||
if (!isRendered)
|
||||
{
|
||||
container.setStyle('left', (mouseCoords.x - 10) + "px");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var fontOnClick = function(event)
|
||||
{
|
||||
var value = this.getAttribute('id');
|
||||
updateFunction(value);
|
||||
cleanScreenEvent();
|
||||
};
|
||||
|
||||
// Register event listeners on elements ...
|
||||
for (var i = 0; i < elemLinkIds.length; i++)
|
||||
{
|
||||
var elementId = elemLinkIds[i];
|
||||
$(elementId).addEvent('click', fontOnClick.bind($(elementId)));
|
||||
}
|
||||
}
|
||||
86
wise-webapp/src/main/webapp/js/embedded.js
Normal file
86
wise-webapp/src/main/webapp/js/embedded.js
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
function afterCoreLoading()
|
||||
{
|
||||
if (core.UserAgent.isVMLSupported())
|
||||
{
|
||||
$import("../js/mindplot.vml-min.js");
|
||||
} else
|
||||
{
|
||||
$import("../js/mindplot.svg-min.js");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
afterCoreLoading();
|
||||
|
||||
function afterMindpotLibraryLoading()
|
||||
{
|
||||
buildMindmapDesigner();
|
||||
|
||||
$('zoomIn').addEvent('click', function(event) {
|
||||
designer.zoomIn();
|
||||
});
|
||||
|
||||
$('zoomOut').addEvent('click', function(event) {
|
||||
designer.zoomOut();
|
||||
});
|
||||
|
||||
|
||||
// If not problem has occured, I close the dialod ...
|
||||
var closeDialog = function() {
|
||||
|
||||
if (!window.hasUnexpectedErrors)
|
||||
{
|
||||
waitDialog.deactivate();
|
||||
}
|
||||
}.delay(500);
|
||||
|
||||
}
|
||||
|
||||
function setCurrentColorPicker(colorPicker)
|
||||
{
|
||||
this.currentColorPicker = colorPicker;
|
||||
}
|
||||
|
||||
|
||||
function buildMindmapDesigner()
|
||||
{
|
||||
|
||||
var container = $('mindplot');
|
||||
|
||||
// Initialize Editor ...
|
||||
var persistantManager = new mindplot.PersistanceManager(window.MapEditorService);
|
||||
|
||||
var screenWidth = window.getWidth();
|
||||
var screenHeight = window.getHeight();
|
||||
|
||||
// body margin ...
|
||||
editorProperties.width = screenWidth;
|
||||
editorProperties.height = screenHeight;
|
||||
editorProperties.viewMode = true;
|
||||
|
||||
designer = new mindplot.MindmapDesigner(editorProperties, container, persistantManager);
|
||||
designer.loadFromXML(mapId, mapXml);
|
||||
|
||||
// If a node has focus, focus can be move to another node using the keys.
|
||||
designer._cleanScreen = function() {
|
||||
};
|
||||
}
|
||||
79
wise-webapp/src/main/webapp/js/help.js
Normal file
79
wise-webapp/src/main/webapp/js/help.js
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var Help = {
|
||||
buildHelp:function(panel){
|
||||
var container = new Element('div');
|
||||
container.setStyles({width:'100%', textAlign:'center'});
|
||||
var content1 = Help.buildContentIcon('../images/black-keyboard.png', 'Keyboard Shortcuts', function(){MOOdalBox.open('keyboard.htm','KeyBoard Shortcuts', '500px 400px', false);panel.hidePanel();});
|
||||
var content2 = Help.buildContentIcon('../images/firstSteps.png', 'Editor First Steps', function(){
|
||||
var wOpen;
|
||||
var sOptions;
|
||||
|
||||
sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
|
||||
sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
|
||||
sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
|
||||
sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
|
||||
|
||||
wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
|
||||
wOpen.focus();
|
||||
wOpen.moveTo( 0, 0 );
|
||||
wOpen.resizeTo( screen.availWidth, screen.availHeight );
|
||||
panel.hidePanel();
|
||||
});
|
||||
|
||||
container.addEvent('show', function(){
|
||||
content1.effect('opacity',{duration:800}).start(0,100);
|
||||
var eff = function(){content2.effect('opacity',{duration:800}).start(0,100);};
|
||||
eff.delay(150);
|
||||
});
|
||||
container.addEvent('hide', function(){
|
||||
content1.effect('opacity').set(0);
|
||||
content2.effect('opacity').set(0)
|
||||
});
|
||||
content1.inject(container);
|
||||
content2.inject(container);
|
||||
return container;
|
||||
},
|
||||
buildContentIcon:function(image, text, onClickFn){
|
||||
var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'});
|
||||
|
||||
var icon = new Element('div');
|
||||
icon.addEvent('click',onClickFn);
|
||||
var img = new Element('img');
|
||||
img.setProperty('src',image);
|
||||
img.inject(icon);
|
||||
icon.inject(container);
|
||||
|
||||
var textContainer = new Element('div').setStyles({width:'100%', color:'white'});
|
||||
textContainer.innerHTML=text;
|
||||
textContainer.inject(container);
|
||||
|
||||
container.addEvent('mouseover', function(event){
|
||||
$(this).setStyle('border-top', '1px solid #BBB4D6');
|
||||
$(this).setStyle('border-bottom', '1px solid #BBB4D6');
|
||||
}.bindWithEvent(container));
|
||||
container.addEvent('mouseout', function(event){
|
||||
$(this).setStyle('border-top', '1px solid transparent');
|
||||
$(this).setStyle('border-bottom', '1px solid transparent');
|
||||
|
||||
}.bindWithEvent(container));
|
||||
return container;
|
||||
}
|
||||
};
|
||||
103
wise-webapp/src/main/webapp/js/helpPanel.js
Normal file
103
wise-webapp/src/main/webapp/js/helpPanel.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var Panel = new Class({
|
||||
options:{
|
||||
width:'140px',
|
||||
height:250,
|
||||
opacity:0.9,
|
||||
panelButton:null,
|
||||
content:null,
|
||||
frame:null,
|
||||
onStart:Class.empty,
|
||||
onComplete:Class.empty
|
||||
},
|
||||
initialize:function(options){
|
||||
this.setOptions(options);
|
||||
|
||||
this.buildBody();
|
||||
|
||||
//atach listener to button
|
||||
this.options.panelButton.addEvent('click',this.openPanel.bindWithEvent(this));
|
||||
},
|
||||
buildBody:function(){
|
||||
var opts = this.options;
|
||||
opts.frame = new Element('div');
|
||||
if($chk(opts.content))
|
||||
{
|
||||
this.setContent(opts.content);
|
||||
}
|
||||
|
||||
},
|
||||
setContent:function(content){
|
||||
this.options.content=content;
|
||||
this.options.content.inject(this.options.frame);
|
||||
this.setInitialStyles();
|
||||
this.options.frame.injectBefore(this.options.panelButton);
|
||||
},
|
||||
setInitialStyles:function(){
|
||||
var opts = this.options;
|
||||
var buttonTop = opts.panelButton.getTop();
|
||||
var buttonLeft = opts.panelButton.getLeft();
|
||||
var bodyHeight = parseInt(opts.panelButton.getParent().getStyle('height'));
|
||||
var coordinates = opts.panelButton.getCoordinates();
|
||||
var width = opts.width || coordinates.width;
|
||||
var elemCoords = {
|
||||
top:'0px',
|
||||
left:coordinates.left,
|
||||
width:width,
|
||||
height:'0px',
|
||||
zIndex:'10',
|
||||
overflow:'hidden'
|
||||
};
|
||||
var elemStyles = {
|
||||
backgroundColor: opts.backgroundColor||'blue',
|
||||
opacity: opts.opacity,
|
||||
position:'absolute'
|
||||
}
|
||||
opts.frame.setStyles(elemCoords).setStyles(elemStyles);
|
||||
},
|
||||
openPanel:function(){
|
||||
this.fireEvent('onStart');
|
||||
|
||||
var button = this.options.panelButton;
|
||||
button.removeEvents('click');
|
||||
button.addEvent('click',this.hidePanel.bindWithEvent(this));
|
||||
var top = parseInt(this.options.frame.getStyle('top'));
|
||||
var fx = this.options.frame.effects({duration:500, onComplete:function(){this.options.content.fireEvent('show');}.bind(this)});
|
||||
fx.start({'height':[0,this.options.height],'top':[top, top-this.options.height]});
|
||||
|
||||
this.fireEvent('onComplete');
|
||||
},
|
||||
hidePanel:function(){
|
||||
this.fireEvent('onStart');
|
||||
|
||||
var button = this.options.panelButton;
|
||||
button.removeEvents('click');
|
||||
button.addEvent('click',this.openPanel.bindWithEvent(this));
|
||||
var top = parseInt(this.options.frame.getStyle('top'));
|
||||
this.options.content.fireEvent('hide');
|
||||
var fx = this.options.frame.effects({duration:500});
|
||||
fx.start({'height':[this.options.height,0],'top':[top, top+this.options.height]});
|
||||
|
||||
this.fireEvent('onComplete');
|
||||
}
|
||||
});
|
||||
|
||||
Panel.implement(new Events, new Options);
|
||||
74
wise-webapp/src/main/webapp/js/menu.js
Normal file
74
wise-webapp/src/main/webapp/js/menu.js
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var Menu = {
|
||||
init: function ()
|
||||
{
|
||||
$ES('.subMenu2', $('mydocs')).each(function(el) {
|
||||
var parent = el.getParent();
|
||||
var button = $E('.button', parent);
|
||||
if (button.getTag() == 'div')
|
||||
{
|
||||
el.setStyle('top', '25px');
|
||||
el.setStyle('left', '7px');
|
||||
}
|
||||
button.addEvent('click', this.updateSubMenu.bindWithEvent(this, [button, el]));
|
||||
button.state = "closed";
|
||||
}, this);
|
||||
|
||||
this.currentElement = null;
|
||||
this.currentItem = null;
|
||||
$(document).addEvent('click', this.hide.bindWithEvent(this));
|
||||
},
|
||||
updateSubMenu: function(event, src, el)
|
||||
{
|
||||
if (src.state == "open")
|
||||
{
|
||||
el.setStyle("visibility", "hidden");
|
||||
src.state = "closed";
|
||||
this.currentElement = null;
|
||||
this.currentItem = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.currentElement != null)
|
||||
{
|
||||
this.hide.attempt(null, this);
|
||||
}
|
||||
this.currentElement = el;
|
||||
this.currentItem = src;
|
||||
el.setStyle("visibility", "visible");
|
||||
src.state = "open";
|
||||
}
|
||||
if (event != null)
|
||||
{
|
||||
var evt = new Event(event);
|
||||
evt.stopPropagation();
|
||||
}
|
||||
},
|
||||
hide: function(event)
|
||||
{
|
||||
if (this.currentElement != null)
|
||||
{
|
||||
this.updateSubMenu.attempt([event, this.currentItem, this.currentElement], this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Window.onDomReady(Menu.init.bind(Menu));
|
||||
114
wise-webapp/src/main/webapp/js/menu2.js
Normal file
114
wise-webapp/src/main/webapp/js/menu2.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
Window.onDomReady(function() {
|
||||
// variable for the list status
|
||||
var listStatus = 'closed';
|
||||
// setup var that holds our opened list's id
|
||||
var listOpen;
|
||||
// show list function
|
||||
var showList = function(lid) {
|
||||
var listId = lid.replace(/For/g, '');
|
||||
// need to check if there is an open list
|
||||
if (listStatus == "open") {
|
||||
// check if the open list is the same
|
||||
// as toggled list. If not, then we hide it
|
||||
if (listId != listOpen) {
|
||||
hideList();
|
||||
}
|
||||
}
|
||||
if (listStatus == "closed") {
|
||||
// set our list status
|
||||
listStatus = 'open';
|
||||
// set the curent open list id
|
||||
listOpen = listId;
|
||||
// show our list with a little effects
|
||||
new fx.Opacity($(listOpen), {duration: 500}).custom(0, 1);
|
||||
new fx.Height($(listOpen), {duration: 300}).custom(20, 40);
|
||||
new fx.Width($(listOpen), {duration: 300}).custom(20, 131);
|
||||
// we add a timeout so the sublist goes away
|
||||
// if the user doesn't click/mouseover another
|
||||
// menu item
|
||||
(hideList).delay(15000);
|
||||
}
|
||||
};
|
||||
// hide list function
|
||||
var hideList = function() {
|
||||
if (listOpen) {
|
||||
// check if our list is shown already - if so run the effects to hide list
|
||||
if ($(listOpen).getStyle('visibility') == "visible") {
|
||||
new fx.Opacity($(listOpen), {duration: 500}).custom(1, 0);
|
||||
new fx.Height($(listOpen), {duration: 300}).custom(40, 20);
|
||||
new fx.Width($(listOpen), {duration: 300}).custom(131, 20);
|
||||
}
|
||||
// set our list status
|
||||
listStatus = 'closed';
|
||||
// reset open list id
|
||||
listOpen = '';
|
||||
}
|
||||
};
|
||||
$ES('a.navbutton').action({
|
||||
// initialize the submenu - gets general data in order to attempt to position
|
||||
// the submenu in relation to the image/anchor tag that opens it
|
||||
initialize: function() {
|
||||
// check if element has our flag for having a drop menu
|
||||
if (this.hasClass('hasSubNav')) {
|
||||
var listId = this.name.replace(/For/g, '');
|
||||
// have to do it this way.
|
||||
// for some reason this.firstChild.getTag() won't work
|
||||
if ($(this.firstChild).getTag() == 'img') {
|
||||
// attempt to set offset to be a little taller
|
||||
// than your image
|
||||
var yOffset = this.firstChild.height + 1;
|
||||
} else {
|
||||
// set your default offset here
|
||||
var yOffset = 20;
|
||||
}
|
||||
// set the styles of your list
|
||||
// to position it (relatively) correctly
|
||||
$(listId).setStyles({ top: yOffset + 'px', left: this.getLeft() + 'px' });
|
||||
}
|
||||
},
|
||||
onmouseover: function() {
|
||||
// add mouseover action to change image
|
||||
this.firstChild.src = this.firstChild.src.replace(/off/g, 'on');
|
||||
// optional effect for mouseover
|
||||
this.effect('opacity').custom(.3, 1);
|
||||
// check if element has our flag for having a drop menu
|
||||
if (this.hasClass('hasSubNav')) {
|
||||
// pass the id of the mouseover, so we can determine
|
||||
// which list to show
|
||||
showList(this.id);
|
||||
} else {
|
||||
// if the button moused over does not have a list
|
||||
// then we close the list since we are obviously
|
||||
// on another button now
|
||||
if (listStatus == 'open') {
|
||||
hideList();
|
||||
}
|
||||
}
|
||||
},
|
||||
onmouseout: function() {
|
||||
// switch mouseout button
|
||||
this.firstChild.src = this.firstChild.src.replace(/on/g, 'off');
|
||||
// optional effect for mouseout
|
||||
this.effect('opacity').custom(.3, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
626
wise-webapp/src/main/webapp/js/mooRainbow.js
Executable file
626
wise-webapp/src/main/webapp/js/mooRainbow.js
Executable file
@@ -0,0 +1,626 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/***
|
||||
* MooRainbow
|
||||
*
|
||||
* @version 1.0
|
||||
* @license MIT-style license
|
||||
* @author w00fz - < w00fzIT [at] gmail.com >
|
||||
* @infos http://w00fz.altervista.org/mooRainbow
|
||||
* @copyright Author
|
||||
*
|
||||
* Lot of thanks also to kamicane, tomocchino, ibolmo, Inviz.
|
||||
*/
|
||||
|
||||
var MooRainbow = new Class({
|
||||
options: {
|
||||
id: 'mooRainbow',
|
||||
prefix: 'moor-',
|
||||
imgPath: 'images/',
|
||||
startColor: [255, 0, 0],
|
||||
wheel: false,
|
||||
onComplete: Class.empty,
|
||||
onChange: Class.empty
|
||||
},
|
||||
|
||||
initialize: function(el, options) {
|
||||
this.element = $(el);
|
||||
if (!this.element) return;
|
||||
this.setOptions(options);
|
||||
|
||||
this.sliderPos = 0;
|
||||
this.pickerPos = {x: 0, y: 0};
|
||||
this.backupColor = this.options.startColor;
|
||||
this.currentColor = this.options.startColor;
|
||||
this.sets = {
|
||||
rgb: [],
|
||||
hsb: [],
|
||||
hex: []
|
||||
};
|
||||
this.pickerClick = this.sliderClick = false;
|
||||
if (!this.layout) this.doLayout();
|
||||
this.OverlayEvents();
|
||||
this.sliderEvents();
|
||||
this.backupEvent();
|
||||
if (this.options.wheel) this.wheelEvents();
|
||||
this.element.addEvent('click', function(e) {
|
||||
this.toggle(e);
|
||||
}.bind(this));
|
||||
|
||||
this.layout.overlay.setStyle('background-color', this.options.startColor.rgbToHex());
|
||||
this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
|
||||
|
||||
this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
|
||||
this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
|
||||
|
||||
this.manualSet(this.options.startColor);
|
||||
|
||||
this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
|
||||
this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
|
||||
this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int');
|
||||
|
||||
if (window.khtml) this.hide();
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
this[this.visible ? 'hide' : 'show']()
|
||||
},
|
||||
|
||||
show: function() {
|
||||
this.fireEvent('onInit', [this.sets, this]);
|
||||
this.rePosition();
|
||||
this.layout.setStyle('display', 'block');
|
||||
this.visible = true;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.layout.setStyles({'display': 'none'});
|
||||
this.visible = false;
|
||||
},
|
||||
|
||||
manualSet: function(color, type) {
|
||||
if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
|
||||
var rgb, hsb, hex;
|
||||
|
||||
if (type == 'rgb') {
|
||||
rgb = color;
|
||||
hsb = color.rgbToHsb();
|
||||
hex = color.rgbToHex();
|
||||
}
|
||||
else if (type == 'hsb') {
|
||||
hsb = color;
|
||||
rgb = color.hsbToRgb();
|
||||
hex = rgb.rgbToHex();
|
||||
}
|
||||
else {
|
||||
hex = color;
|
||||
rgb = color.hexToRgb();
|
||||
hsb = rgb.rgbToHsb();
|
||||
}
|
||||
|
||||
this.setMooRainbow(rgb);
|
||||
this.autoSet(hsb);
|
||||
},
|
||||
|
||||
autoSet: function(hsb) {
|
||||
var curH = this.snippet('curSize', 'int').h;
|
||||
var curW = this.snippet('curSize', 'int').w;
|
||||
var oveH = this.layout.overlay.height;
|
||||
var oveW = this.layout.overlay.width;
|
||||
var sliH = this.layout.slider.height;
|
||||
var arwH = this.snippet('arrSize', 'int');
|
||||
var hue;
|
||||
|
||||
var posx = Math.round(((oveW * hsb[1]) / 100) - curW);
|
||||
var posy = Math.round(- ((oveH * hsb[2]) / 100) + oveH - curH);
|
||||
|
||||
var c = Math.round(((sliH * hsb[0]) / 360));
|
||||
c = (c == 360) ? 0 : c;
|
||||
var position = sliH - c + this.snippet('slider') - arwH;
|
||||
hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
|
||||
|
||||
this.layout.cursor.setStyles({'top': posy, 'left': posx});
|
||||
this.layout.arrows.setStyle('top', position);
|
||||
this.layout.overlay.setStyle('background-color', hue);
|
||||
this.sliderPos = this.snippet('arrPos') - arwH;
|
||||
this.pickerPos.x = this.snippet('curPos').l + curW;
|
||||
this.pickerPos.y = this.snippet('curPos').t + curH;
|
||||
},
|
||||
|
||||
setMooRainbow: function(color, type) {
|
||||
if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
|
||||
var rgb, hsb, hex;
|
||||
|
||||
if (type == 'rgb') {
|
||||
rgb = color;
|
||||
hsb = color.rgbToHsb();
|
||||
hex = color.rgbToHex();
|
||||
}
|
||||
else if (type == 'hsb') {
|
||||
hsb = color;
|
||||
rgb = color.hsbToRgb();
|
||||
hex = rgb.rgbToHex();
|
||||
}
|
||||
else {
|
||||
hex = color;
|
||||
rgb = color.hexToRgb();
|
||||
hsb = rgb.rgbToHsb();
|
||||
}
|
||||
|
||||
this.sets = {
|
||||
rgb: rgb,
|
||||
hsb: hsb,
|
||||
hex: hex
|
||||
};
|
||||
|
||||
if (!$chk(this.pickerPos.x))
|
||||
this.autoSet(hsb);
|
||||
|
||||
this.RedInput.value = rgb[0];
|
||||
this.GreenInput.value = rgb[1];
|
||||
this.BlueInput.value = rgb[2];
|
||||
this.HueInput.value = hsb[0];
|
||||
this.SatuInput.value = hsb[1];
|
||||
this.BrighInput.value = hsb[2];
|
||||
this.hexInput.value = hex;
|
||||
|
||||
this.currentColor = rgb;
|
||||
|
||||
this.chooseColor.setStyle('background-color', rgb.rgbToHex());
|
||||
},
|
||||
|
||||
parseColors: function(x, y, z) {
|
||||
var s = Math.round((x * 100) / this.layout.overlay.width);
|
||||
var b = 100 - Math.round((y * 100) / this.layout.overlay.height);
|
||||
var h = 360 - Math.round((z * 360) / this.layout.slider.height) + this.snippet('slider') - this.snippet('arrSize', 'int');
|
||||
h -= this.snippet('arrSize', 'int');
|
||||
h = (h >= 360) ? 0 : (h < 0) ? 0 : h;
|
||||
s = (s > 100) ? 100 : (s < 0) ? 0 : s;
|
||||
b = (b > 100) ? 100 : (b < 0) ? 0 : b;
|
||||
|
||||
return [h, s, b];
|
||||
},
|
||||
|
||||
OverlayEvents: function() {
|
||||
var lim, curH, curW, inputs;
|
||||
curH = this.snippet('curSize', 'int').h;
|
||||
curW = this.snippet('curSize', 'int').w;
|
||||
inputs = this.arrRGB.copy().concat(this.arrHSB, this.hexInput);
|
||||
|
||||
document.addEvent('click', function() {
|
||||
if (this.visible) this.hide(this.layout);
|
||||
}.bind(this));
|
||||
|
||||
inputs.each(function(el) {
|
||||
el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el));
|
||||
el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el));
|
||||
}, this);
|
||||
[this.element, this.layout].each(function(el) {
|
||||
el.addEvents({
|
||||
'click': function(e) {
|
||||
new Event(e).stop();
|
||||
},
|
||||
'keyup': function(e) {
|
||||
e = new Event(e);
|
||||
if (e.key == 'esc' && this.visible) this.hide(this.layout);
|
||||
}.bind(this)
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
lim = {
|
||||
x: [0 - curW, (this.layout.overlay.width - curW)],
|
||||
y: [0 - curH, (this.layout.overlay.height - curH)]
|
||||
};
|
||||
|
||||
this.layout.drag = new Drag.Base(this.layout.cursor, {
|
||||
limit: lim,
|
||||
onStart: this.overlayDrag.bind(this),
|
||||
onDrag: this.overlayDrag.bind(this),
|
||||
snap: 0
|
||||
});
|
||||
|
||||
this.layout.overlay2.addEvent('mousedown', function(e) {
|
||||
e = new Event(e);
|
||||
this.layout.cursor.setStyles({
|
||||
'top': e.page.y - this.layout.overlay.getTop() - curH,
|
||||
'left': e.page.x - this.layout.overlay.getLeft() - curW
|
||||
});
|
||||
this.layout.drag.start(e);
|
||||
}.bind(this));
|
||||
|
||||
this.okButton.addEvent('click', function() {
|
||||
if (this.currentColor == this.options.startColor) {
|
||||
this.hide();
|
||||
this.fireEvent('onComplete', [this.sets, this]);
|
||||
}
|
||||
else {
|
||||
this.backupColor = this.currentColor;
|
||||
this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
|
||||
this.hide();
|
||||
this.fireEvent('onComplete', [this.sets, this]);
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
overlayDrag: function() {
|
||||
var curH = this.snippet('curSize', 'int').h;
|
||||
var curW = this.snippet('curSize', 'int').w;
|
||||
this.pickerPos.x = this.snippet('curPos').l + curW;
|
||||
this.pickerPos.y = this.snippet('curPos').t + curH;
|
||||
|
||||
this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
},
|
||||
|
||||
sliderEvents: function() {
|
||||
var arwH = this.snippet('arrSize', 'int'), lim;
|
||||
|
||||
lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')];
|
||||
this.layout.sliderDrag = new Drag.Base(this.layout.arrows, {
|
||||
limit: {y: lim},
|
||||
modifiers: {x: false},
|
||||
onStart: this.sliderDrag.bind(this),
|
||||
onDrag: this.sliderDrag.bind(this),
|
||||
snap: 0
|
||||
});
|
||||
|
||||
this.layout.slider.addEvent('mousedown', function(e) {
|
||||
e = new Event(e);
|
||||
|
||||
this.layout.arrows.setStyle(
|
||||
'top', e.page.y - this.layout.slider.getTop() + this.snippet('slider') - arwH
|
||||
);
|
||||
this.layout.sliderDrag.start(e);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
sliderDrag: function() {
|
||||
var arwH = this.snippet('arrSize', 'int'), hue;
|
||||
|
||||
this.sliderPos = this.snippet('arrPos') - arwH;
|
||||
this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
|
||||
hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
|
||||
this.layout.overlay.setStyle('background-color', hue);
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
},
|
||||
|
||||
backupEvent: function() {
|
||||
this.layout.backup.addEvent('click', function() {
|
||||
this.manualSet(this.backupColor);
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
wheelEvents: function() {
|
||||
var arrColors = this.arrRGB.copy().extend(this.arrHSB);
|
||||
|
||||
arrColors.each(function(el) {
|
||||
el.addEvents({
|
||||
'mousewheel': this.eventKeys.bindWithEvent(this, el),
|
||||
'keydown': this.eventKeys.bindWithEvent(this, el)
|
||||
});
|
||||
}, this);
|
||||
|
||||
[this.layout.arrows, this.layout.slider].each(function(el) {
|
||||
el.addEvents({
|
||||
'mousewheel': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']),
|
||||
'keydown': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider'])
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
|
||||
eventKeys: function(e, el, id) {
|
||||
var wheel, type;
|
||||
id = (!id) ? el.id : this.arrHSB[0];
|
||||
|
||||
if (e.type == 'keydown') {
|
||||
if (e.key == 'up') wheel = 1;
|
||||
else if (e.key == 'down') wheel = -1;
|
||||
else return;
|
||||
} else if (e.type == Element.Events.mousewheel.type) wheel = (e.wheel > 0) ? 1 : -1;
|
||||
|
||||
if (this.arrRGB.test(el)) type = 'rgb';
|
||||
else if (this.arrHSB.test(el)) type = 'hsb';
|
||||
else type = 'hsb';
|
||||
|
||||
if (type == 'rgb') {
|
||||
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
|
||||
var value = el.value.toInt() + wheel;
|
||||
value = (value > 255) ? 255 : (value < 0) ? 0 : value;
|
||||
|
||||
switch (el.className) {
|
||||
case prefix + 'rInput': pass = [value, rgb[1], rgb[2]]; break;
|
||||
case prefix + 'gInput': pass = [rgb[0], value, rgb[2]]; break;
|
||||
case prefix + 'bInput': pass = [rgb[0], rgb[1], value]; break;
|
||||
default : pass = rgb;
|
||||
}
|
||||
this.manualSet(pass);
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
} else {
|
||||
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
|
||||
var value = el.value.toInt() + wheel;
|
||||
|
||||
if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value;
|
||||
else value = (value > 100) ? 100 : (value < 0) ? 0 : value;
|
||||
|
||||
switch (el.className) {
|
||||
case prefix + 'HueInput': pass = [value, hsb[1], hsb[2]]; break;
|
||||
case prefix + 'SatuInput': pass = [hsb[0], value, hsb[2]]; break;
|
||||
case prefix + 'BrighInput': pass = [hsb[0], hsb[1], value]; break;
|
||||
default : pass = hsb;
|
||||
}
|
||||
this.manualSet(pass, 'hsb');
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
}
|
||||
e.stop();
|
||||
},
|
||||
|
||||
eventKeydown: function(e, el) {
|
||||
var n = e.code, k = e.key;
|
||||
|
||||
if ((!el.className.test(/hexInput/) && !(n >= 48 && n <= 57)) &&
|
||||
(k != 'backspace' && k != 'tab' && k != 'delete' && k != 'left' && k != 'right'))
|
||||
e.stop();
|
||||
},
|
||||
|
||||
eventKeyup: function(e, el) {
|
||||
var n = e.code, k = e.key, pass, prefix, chr = el.value.charAt(0);
|
||||
|
||||
if (!$chk(el.value)) return;
|
||||
if (el.className.test(/hexInput/)) {
|
||||
if (chr != "#" && el.value.length != 6) return;
|
||||
if (chr == '#' && el.value.length != 7) return;
|
||||
} else {
|
||||
if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].test(k)) && el.value.length > 3) return;
|
||||
}
|
||||
|
||||
prefix = this.options.prefix;
|
||||
|
||||
if (el.className.test(/(rInput|gInput|bInput)/)) {
|
||||
if (el.value < 0 || el.value > 255) return;
|
||||
switch (el.className) {
|
||||
case prefix + 'rInput': pass = [el.value, this.sets.rgb[1], this.sets.rgb[2]]; break;
|
||||
case prefix + 'gInput': pass = [this.sets.rgb[0], el.value, this.sets.rgb[2]]; break;
|
||||
case prefix + 'bInput': pass = [this.sets.rgb[0], this.sets.rgb[1], el.value]; break;
|
||||
default : pass = this.sets.rgb;
|
||||
}
|
||||
this.manualSet(pass);
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
}
|
||||
else if (!el.className.test(/hexInput/)) {
|
||||
if (el.className.test(/HueInput/) && el.value < 0 || el.value > 360) return;
|
||||
else if (el.className.test(/HueInput/) && el.value == 360) el.value = 0;
|
||||
else if (el.className.test(/(SatuInput|BrighInput)/) && el.value < 0 || el.value > 100) return;
|
||||
switch (el.className) {
|
||||
case prefix + 'HueInput': pass = [el.value, this.sets.hsb[1], this.sets.hsb[2]]; break;
|
||||
case prefix + 'SatuInput': pass = [this.sets.hsb[0], el.value, this.sets.hsb[2]]; break;
|
||||
case prefix + 'BrighInput': pass = [this.sets.hsb[0], this.sets.hsb[1], el.value]; break;
|
||||
default : pass = this.sets.hsb;
|
||||
}
|
||||
this.manualSet(pass, 'hsb');
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
} else {
|
||||
pass = el.value.hexToRgb(true);
|
||||
if (isNaN(pass[0]) || isNaN(pass[1]) || isNaN(pass[2])) return;
|
||||
|
||||
if ($chk(pass)) {
|
||||
this.manualSet(pass);
|
||||
this.fireEvent('onChange', [this.sets, this]);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
doLayout: function() {
|
||||
var id = this.options.id, prefix = this.options.prefix;
|
||||
var idPrefix = id + ' .' + prefix;
|
||||
|
||||
this.layout = new Element('div', {
|
||||
'styles': {'display': 'block', 'position': 'absolute'},
|
||||
'id': id
|
||||
}).inject(document.body);
|
||||
|
||||
var box = new Element('div', {
|
||||
'styles': {'position': 'relative'},
|
||||
'class': prefix + 'box'
|
||||
}).inject(this.layout);
|
||||
|
||||
var div = new Element('div', {
|
||||
'styles': {'position': 'absolute', 'overflow': 'hidden'},
|
||||
'class': prefix + 'overlayBox'
|
||||
}).inject(box);
|
||||
|
||||
var ar = new Element('div', {
|
||||
'styles': {'position': 'absolute', 'zIndex': 1},
|
||||
'class': prefix + 'arrows'
|
||||
}).inject(box);
|
||||
ar.width = ar.getStyle('width').toInt();
|
||||
ar.height = ar.getStyle('height').toInt();
|
||||
|
||||
var ov = new Element('img', {
|
||||
'styles': {'background-color': '#fff', 'position': 'relative', 'zIndex': 2},
|
||||
'src': this.options.imgPath + 'moor_woverlay.png',
|
||||
'class': prefix + 'overlay'
|
||||
}).inject(div);
|
||||
|
||||
var ov2 = new Element('img', {
|
||||
'styles': {'position': 'absolute', 'top': 0, 'left': 0, 'zIndex': 2},
|
||||
'src': this.options.imgPath + 'moor_boverlay.png',
|
||||
'class': prefix + 'overlay'
|
||||
}).inject(div);
|
||||
|
||||
if (window.ie6) {
|
||||
div.setStyle('overflow', '');
|
||||
var src = ov.src;
|
||||
ov.src = this.options.imgPath + 'blank.gif';
|
||||
ov.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
|
||||
src = ov2.src;
|
||||
ov2.src = this.options.imgPath + 'blank.gif';
|
||||
ov2.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
|
||||
}
|
||||
ov.width = ov2.width = div.getStyle('width').toInt();
|
||||
ov.height = ov2.height = div.getStyle('height').toInt();
|
||||
|
||||
var cr = new Element('div', {
|
||||
'styles': {'overflow': 'hidden', 'position': 'absolute', 'zIndex': 2},
|
||||
'class': prefix + 'cursor'
|
||||
}).inject(div);
|
||||
cr.width = cr.getStyle('width').toInt();
|
||||
cr.height = cr.getStyle('height').toInt();
|
||||
|
||||
var sl = new Element('img', {
|
||||
'styles': {'position': 'absolute', 'z-index': 2},
|
||||
'src': this.options.imgPath + 'moor_slider.png',
|
||||
'class': prefix + 'slider'
|
||||
}).inject(box);
|
||||
this.layout.slider = sl;
|
||||
//$E('#' + idPrefix + 'slider');
|
||||
sl.width = sl.getStyle('width').toInt();
|
||||
sl.height = sl.getStyle('height').toInt();
|
||||
|
||||
new Element('div', {
|
||||
'styles': {'position': 'absolute'},
|
||||
'class': prefix + 'colorBox'
|
||||
}).inject(box);
|
||||
|
||||
var chooseColor = new Element('div', {
|
||||
'styles': {'zIndex': 2, 'position': 'absolute'},
|
||||
'class': prefix + 'chooseColor'
|
||||
}).inject(box);
|
||||
|
||||
this.layout.backup = new Element('div', {
|
||||
'styles': {'zIndex': 2, 'position': 'absolute', 'cursor': 'pointer'},
|
||||
'class': prefix + 'currentColor'
|
||||
}).inject(box);
|
||||
|
||||
var R = new Element('label').inject(box).setStyle('position', 'absolute');
|
||||
var G = R.clone().inject(box).addClass(prefix + 'gLabel').appendText('G: ');
|
||||
var B = R.clone().inject(box).addClass(prefix + 'bLabel').appendText('B: ');
|
||||
R.appendText('R: ').addClass(prefix + 'rLabel');
|
||||
|
||||
var inputR = new Element('input');
|
||||
var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput');
|
||||
var inputB = inputR.clone().inject(B).addClass(prefix + 'bInput');
|
||||
inputR.inject(R).addClass(prefix + 'rInput');
|
||||
|
||||
var HU = new Element('label').inject(box).setStyle('position', 'absolute');
|
||||
var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').appendText('S: ');
|
||||
var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').appendText('B: ');
|
||||
HU.appendText('H: ').addClass(prefix + 'HueLabel');
|
||||
|
||||
var inputHU = new Element('input');
|
||||
var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput');
|
||||
var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput');
|
||||
inputHU.inject(HU).addClass(prefix + 'HueInput');
|
||||
SA.appendText(' %');
|
||||
BR.appendText(' %');
|
||||
new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'}).setHTML(" °").injectAfter(HU);
|
||||
|
||||
var inputHex = new Element('input').addClass(prefix + 'hexInput');
|
||||
var hex = new Element('label').inject(box).setStyle('position', 'absolute').addClass(prefix + 'hexLabel').appendText('#hex: ').adopt(inputHex);
|
||||
|
||||
var ok = new Element('input', {
|
||||
'styles': {'position': 'absolute'},
|
||||
'type': 'button',
|
||||
'value': 'Select',
|
||||
'class': prefix + 'okButton'
|
||||
}).inject(box);
|
||||
|
||||
this.rePosition();
|
||||
|
||||
var overlays = $$('#' + idPrefix + 'overlay');
|
||||
this.layout.overlay = ov;
|
||||
//overlays[0];
|
||||
this.layout.overlay2 = ov2;
|
||||
//overlays[1];
|
||||
this.layout.cursor = cr;
|
||||
//$E('#' + idPrefix + 'cursor');
|
||||
this.layout.arrows = ar;
|
||||
//$E('#' + idPrefix + 'arrows');
|
||||
this.chooseColor = chooseColor;
|
||||
//$E('#' + idPrefix + 'chooseColor');
|
||||
//this.layout.backup = $E('#' + idPrefix + 'currentColor');
|
||||
this.RedInput = inputR;
|
||||
//$E('#' + idPrefix + 'rInput');
|
||||
this.GreenInput = inputG;
|
||||
//$E('#' + idPrefix + 'gInput');
|
||||
this.BlueInput = inputB;
|
||||
//$E('#' + idPrefix + 'bInput');
|
||||
this.HueInput = inputHU;
|
||||
//$E('#' + idPrefix + 'HueInput');
|
||||
this.SatuInput = inputSA;
|
||||
//$E('#' + idPrefix + 'SatuInput');
|
||||
this.BrighInput = inputBR;
|
||||
//$E('#' + idPrefix + 'BrighInput');
|
||||
this.hexInput = inputHex;
|
||||
//$E('#' + idPrefix + 'hexInput');
|
||||
|
||||
this.arrRGB = [this.RedInput, this.GreenInput, this.BlueInput];
|
||||
this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput];
|
||||
this.okButton = ok;
|
||||
//$E('#' + idPrefix + 'okButton');
|
||||
|
||||
if (!window.khtml) this.hide();
|
||||
},
|
||||
rePosition: function() {
|
||||
var coords = this.element.getCoordinates();
|
||||
this.layout.setStyles({
|
||||
'left': coords.left,
|
||||
'top': coords.top + coords.height + 1
|
||||
});
|
||||
},
|
||||
|
||||
snippet: function(mode, type) {
|
||||
var size;
|
||||
type = (type) ? type : 'none';
|
||||
|
||||
switch (mode) {
|
||||
case 'arrPos':
|
||||
var t = this.layout.arrows.getStyle('top').toInt();
|
||||
size = t;
|
||||
break;
|
||||
case 'arrSize':
|
||||
var h = this.layout.arrows.height;
|
||||
h = (type == 'int') ? (h / 2).toInt() : h;
|
||||
size = h;
|
||||
break;
|
||||
case 'curPos':
|
||||
var l = this.layout.cursor.getStyle('left').toInt();
|
||||
var t = this.layout.cursor.getStyle('top').toInt();
|
||||
size = {'l': l, 't': t};
|
||||
break;
|
||||
case 'slider':
|
||||
var t = this.layout.slider.getStyle('marginTop').toInt();
|
||||
size = t;
|
||||
break;
|
||||
default :
|
||||
var h = this.layout.cursor.height;
|
||||
var w = this.layout.cursor.width;
|
||||
h = (type == 'int') ? (h / 2).toInt() : h;
|
||||
w = (type == 'int') ? (w / 2).toInt() : w;
|
||||
size = {w: w, h: h};
|
||||
}
|
||||
;
|
||||
return size;
|
||||
}
|
||||
});
|
||||
|
||||
MooRainbow.implement(new Options);
|
||||
MooRainbow.implement(new Events);
|
||||
7173
wise-webapp/src/main/webapp/js/mootools.js
Normal file
7173
wise-webapp/src/main/webapp/js/mootools.js
Normal file
File diff suppressed because it is too large
Load Diff
298
wise-webapp/src/main/webapp/js/shadedborder.js
Normal file
298
wise-webapp/src/main/webapp/js/shadedborder.js
Normal file
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* RUZEE.ShadedBorder 0.2
|
||||
* (c) 2006 Steffen Rusitschka
|
||||
*
|
||||
* RUZEE.ShadedBorder is freely distributable under the terms of an MIT-style license.
|
||||
* For details, see http://www.ruzee.com/
|
||||
*/
|
||||
|
||||
var RUZEE = window.RUZEE || {};
|
||||
|
||||
RUZEE.ShadedBorder = {
|
||||
|
||||
create: function(opts) {
|
||||
var isie = /msie/i.test(navigator.userAgent) && !window.opera;
|
||||
function sty(el, h) {
|
||||
for (k in h) {
|
||||
if (/ie_/.test(k)) {
|
||||
if (isie) el.style[k.substr(3)] = h[k];
|
||||
} else el.style[k] = h[k];
|
||||
}
|
||||
}
|
||||
function crdiv(h) {
|
||||
var el = document.createElement("div");
|
||||
el.className = "sb-gen";
|
||||
sty(el, h);
|
||||
return el;
|
||||
}
|
||||
function op(v) {
|
||||
v = v < 0 ? 0 : v;
|
||||
v = v > 0.99999 ? 0.99999 : v;
|
||||
if (isie) {
|
||||
return " filter:alpha(opacity=" + (v * 100) + ");";
|
||||
} else {
|
||||
return " opacity:" + v + ';';
|
||||
}
|
||||
}
|
||||
|
||||
var sr = opts.shadow || 0;
|
||||
var r = opts.corner || 0;
|
||||
var bor = 0;
|
||||
var bow = opts.border || 0;
|
||||
var shadow = sr != 0;
|
||||
var lw = r > sr ? r : sr;
|
||||
var rw = lw;
|
||||
var th = lw;
|
||||
var bh = lw;
|
||||
if (bow > 0) {
|
||||
bor = r;
|
||||
r = r - bow;
|
||||
}
|
||||
var cx = r != 0 && shadow ? Math.round(lw / 3) : 0;
|
||||
var cy = cx;
|
||||
var cs = Math.round(cx / 2);
|
||||
var iclass = r > 0 ? "sb-inner" : "sb-shadow";
|
||||
var sclass = "sb-shadow";
|
||||
var bclass = "sb-border";
|
||||
var edges = opts.edges || "trlb";
|
||||
if (!/t/i.test(edges)) th = 0;
|
||||
if (!/b/i.test(edges)) bh = 0;
|
||||
if (!/l/i.test(edges)) lw = 0;
|
||||
if (!/r/i.test(edges)) rw = 0;
|
||||
|
||||
var p = { position:"absolute", left:"0", top:"0", width:lw + "px", height:th + "px",
|
||||
ie_fontSize:"1px", overflow:"hidden" };
|
||||
var tl = crdiv(p);
|
||||
delete p.left;
|
||||
p.right = "0";
|
||||
p.width = rw + "px";
|
||||
var tr = crdiv(p);
|
||||
delete p.top;
|
||||
p.bottom = "0";
|
||||
p.height = bh + "px";
|
||||
var br = crdiv(p);
|
||||
delete p.right;
|
||||
p.left = "0";
|
||||
p.width = lw + "px";
|
||||
var bl = crdiv(p);
|
||||
|
||||
var tw = crdiv({ position:"absolute", width:"100%", height:th + "px", ie_fontSize:"1px",
|
||||
top:"0", left:"0", overflow:"hidden" });
|
||||
var t = crdiv({ position:"relative", height:th + "px", ie_fontSize:"1px", marginLeft:lw + "px",
|
||||
marginRight:rw + "px", overflow:"hidden" });
|
||||
tw.appendChild(t);
|
||||
|
||||
var bw = crdiv({ position:"absolute", left:"0", bottom:"0", width:"100%", height:bh + "px",
|
||||
ie_fontSize:"1px", overflow:"hidden" });
|
||||
|
||||
var b = crdiv({ position:"relative", height:bh + "px", ie_fontSize:"1px", marginLeft:lw + "px",
|
||||
marginRight:rw + "px", overflow:"hidden" });
|
||||
|
||||
bw.appendChild(b);
|
||||
|
||||
var mw = crdiv({ position:"absolute", top:(-bh) + "px", left:"0", width:"100%", height:"100%",
|
||||
overflow:"hidden", ie_fontSize:"1px" });
|
||||
|
||||
function corner(el, t, l) {
|
||||
var w = l ? lw : rw;
|
||||
var h = t ? th : bh;
|
||||
var s = t ? cs : -cs;
|
||||
var dsb = [];
|
||||
var dsi = [];
|
||||
var dss = [];
|
||||
|
||||
var xp = 0;
|
||||
var xd = 1;
|
||||
if (l) {
|
||||
xp = w - 1;
|
||||
xd = -1;
|
||||
}
|
||||
for (var x = 0; x < w; ++x) {
|
||||
var yp = 0;
|
||||
var yd = 1;
|
||||
if (t) {
|
||||
yp = h - 1;
|
||||
yd = -1;
|
||||
}
|
||||
for (var y = 0; y < h; ++y) {
|
||||
var div = '<div style="position:absolute; top:' + yp + 'px; left:' + xp + 'px; ' +
|
||||
'width:1px; height:1px; overflow:hidden;';
|
||||
|
||||
var xc = x - cx;
|
||||
var yc = y - cy - s;
|
||||
var d = Math.sqrt(xc * xc + yc * yc);
|
||||
var doShadow = false;
|
||||
|
||||
if (r > 0) {
|
||||
// draw border
|
||||
if (xc < 0 && yc < bor && yc >= r || yc < 0 && xc < bor && xc >= r) {
|
||||
dsb.push(div + '" class="' + bclass + '"></div>');
|
||||
} else
|
||||
if (d < bor && d >= r - 1 && xc >= 0 && yc >= 0) {
|
||||
var dd = div;
|
||||
if (d >= bor - 1) {
|
||||
dd += op(bor - d);
|
||||
doShadow = true;
|
||||
}
|
||||
dsb.push(dd + '" class="' + bclass + '"></div>');
|
||||
}
|
||||
|
||||
// draw inner
|
||||
var dd = div + ' z-index:2;';
|
||||
if (xc < 0 && yc < r || yc < 0 && xc < r) {
|
||||
dsi.push(dd + '" class="' + iclass + '"></div>');
|
||||
} else
|
||||
if (d < r && xc >= 0 && yc >= 0) {
|
||||
if (d >= r - 1) {
|
||||
dd += op(r - d);
|
||||
doShadow = true;
|
||||
}
|
||||
dsi.push(dd + '" class="' + iclass + '"></div>');
|
||||
} else doShadow = true;
|
||||
} else doShadow = true;
|
||||
|
||||
// draw shadow
|
||||
if (sr > 0 && doShadow) {
|
||||
d = Math.sqrt(x * x + y * y);
|
||||
if (d < sr) {
|
||||
dss.push(div + ' z-index:0; ' + op(1 - (d / sr)) + '" class="' + sclass + '"></div>');
|
||||
}
|
||||
}
|
||||
yp += yd;
|
||||
}
|
||||
xp += xd;
|
||||
}
|
||||
el.innerHTML = dss.concat(dsb.concat(dsi)).join('');
|
||||
}
|
||||
|
||||
function mid(mw) {
|
||||
var ds = [];
|
||||
|
||||
ds.push('<div style="position:relative; top:' + (th + bh) + 'px;' +
|
||||
' height:10000px; margin-left:' + (lw - r - cx) + 'px;' +
|
||||
' margin-right:' + (rw - r - cx) + 'px; overflow:hidden;"' +
|
||||
' class="' + iclass + '"></div>');
|
||||
|
||||
var dd = '<div style="position:absolute; width:1px;' +
|
||||
' top:' + (th + bh) + 'px; height:10000px;';
|
||||
for (var x = 0; x < lw - r - cx; ++x) {
|
||||
ds.push(dd + ' left:' + x + 'px;' + op((x + 1.0) / lw) +
|
||||
'" class="' + sclass + '"></div>');
|
||||
}
|
||||
|
||||
for (var x = 0; x < rw - r - cx; ++x) {
|
||||
ds.push(dd + ' right:' + x + 'px;' + op((x + 1.0) / rw) +
|
||||
'" class="' + sclass + '"></div>');
|
||||
}
|
||||
|
||||
if (bow > 0) {
|
||||
var su = ' width:' + bow + 'px;' + '" class="' + bclass + '"></div>';
|
||||
ds.push(dd + ' left:' + (lw - bor - cx) + 'px;' + su);
|
||||
ds.push(dd + ' right:' + (rw - bor - cx) + 'px;' + su);
|
||||
}
|
||||
|
||||
mw.innerHTML = ds.join('');
|
||||
}
|
||||
|
||||
function tb(el, t) {
|
||||
var ds = [];
|
||||
var h = t ? th : bh;
|
||||
var dd = '<div style="height:1px; overflow:hidden; position:absolute;' +
|
||||
' width:100%; left:0px; ';
|
||||
var s = t ? cs : -cs;
|
||||
for (var y = 0; y < h - s - cy - r; ++y) {
|
||||
ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' + op((y + 1) * 1.0 / h) +
|
||||
'" class="' + sclass + '"></div>');
|
||||
}
|
||||
if (y >= bow) {
|
||||
ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' +
|
||||
' height:' + bow + 'px;" class="' + bclass + '"></div>');
|
||||
}
|
||||
|
||||
ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' +
|
||||
' height:' + (r + cy + s) + 'px;" class="' + iclass + '"></div>');
|
||||
|
||||
el.innerHTML = ds.join('');
|
||||
}
|
||||
|
||||
corner(tl, true, true);
|
||||
corner(tr, true, false);
|
||||
corner(bl, false, true);
|
||||
corner(br, false, false);
|
||||
mid(mw);
|
||||
tb(t, true);
|
||||
tb(b, false);
|
||||
|
||||
return {
|
||||
render: function(el) {
|
||||
if (typeof el == 'string') el = document.getElementById(el);
|
||||
if (el.length != undefined) {
|
||||
for (var i = 0; i < el.length; ++i) this.render(el[i]);
|
||||
return;
|
||||
}
|
||||
// remove generated children
|
||||
var node = el.firstChild;
|
||||
while (node) {
|
||||
var nextNode = node.nextSibling;
|
||||
if (node.nodeType == 1 && node.className == 'sb-gen')
|
||||
el.removeChild(node);
|
||||
node = nextNode;
|
||||
}
|
||||
|
||||
var iel = el.firstChild;
|
||||
|
||||
var twc = tw.cloneNode(true);
|
||||
var mwc = mw.cloneNode(true);
|
||||
var bwc = bw.cloneNode(true);
|
||||
|
||||
el.insertBefore(tl.cloneNode(true), iel);
|
||||
el.insertBefore(tr.cloneNode(true), iel);
|
||||
el.insertBefore(bl.cloneNode(true), iel);
|
||||
el.insertBefore(br.cloneNode(true), iel);
|
||||
el.insertBefore(twc, iel);
|
||||
el.insertBefore(mwc, iel);
|
||||
el.insertBefore(bwc, iel);
|
||||
|
||||
if (isie) {
|
||||
function resize() {
|
||||
twc.style.width = bwc.style.width = mwc.style.width = el.offsetWidth + "px";
|
||||
mwc.firstChild.style.height = el.offsetHeight + "px";
|
||||
}
|
||||
el.onresize = resize;
|
||||
resize();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// add our styles to the document
|
||||
document.write(
|
||||
'<style type="text/css">' +
|
||||
'.sb, .sbi, .sb *, .sbi * { position:relative;}' +
|
||||
'* html .sb, * html .sbi { height:1%; }' +
|
||||
'.sbi { display:inline-block; }' +
|
||||
'.sb-inner { background:#ddd; }' +
|
||||
'.sb-shadow { background:#000; }' +
|
||||
'.sb-border { background:#bbb; }' +
|
||||
'</style>'
|
||||
);
|
||||
190
wise-webapp/src/main/webapp/js/slideShow.js
Normal file
190
wise-webapp/src/main/webapp/js/slideShow.js
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/*
|
||||
var _START_TRANSITION_TIME = 2000;
|
||||
var _WAITING_PERIOD = 2800;
|
||||
var _TRANSITION_TIME = 800;
|
||||
|
||||
slideShow = {
|
||||
init: function (options) {
|
||||
// init default options
|
||||
this.options = Object.extend({
|
||||
startTransitionTime: _START_TRANSITION_TIME,
|
||||
waitingPeriod: _WAITING_PERIOD,
|
||||
transitionTime: _TRANSITION_TIME
|
||||
}, options || {});
|
||||
this.scanScreen();
|
||||
this.img = new Element('img').injectInside(this.screen);
|
||||
|
||||
var nextEffect = this.nextEffect.bind(this);
|
||||
|
||||
this.imgEffect = this.img.effect('opacity', { duration: this.options.startTransitionTime, onComplete: nextEffect }).hide();
|
||||
this.steps = 0;
|
||||
this.nextEffect();
|
||||
|
||||
},
|
||||
scanScreen: function () {
|
||||
var el = $E('img[rel]', $(window.body));
|
||||
el.rel = el.getProperty('rel');
|
||||
el.srcs = el.getProperty('srcs');
|
||||
if (el.rel.test('^slideShow', 'i'))
|
||||
{
|
||||
var parent = el.getParent();
|
||||
el.remove();
|
||||
var aDim = el.rel.match(/[0-9.]+(px|%)/g);
|
||||
var width = "500px";
|
||||
var height = "200px";
|
||||
if (aDim && aDim[0])
|
||||
{
|
||||
var w = aDim[0].toInt();
|
||||
if (w > 0)
|
||||
width = w;
|
||||
}
|
||||
if (aDim && aDim[1])
|
||||
{
|
||||
var h = aDim[1].toInt();
|
||||
if (h > 0)
|
||||
height = h;
|
||||
}
|
||||
this.screen = new Element('div').setProperties({width:width, height:height}).injectInside(parent);
|
||||
if (el.srcs)
|
||||
this.screen.srcs = el.srcs;
|
||||
}
|
||||
},
|
||||
nextEffect: function () {
|
||||
switch (this.steps++)
|
||||
{
|
||||
case 0:
|
||||
if (this.showing)
|
||||
this.imgEffect.options.duration = this.options.transitionTime;
|
||||
var srcs = this.screen.srcs.split(',');
|
||||
if (!$defined(this.index))
|
||||
{
|
||||
this.index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.index++;
|
||||
if (this.index >= srcs.length)
|
||||
this.index = 0;
|
||||
}
|
||||
this.img.src = srcs[this.index];
|
||||
this.showing = true;
|
||||
this.imgEffect.start(0, 1);
|
||||
break;
|
||||
case 1:
|
||||
this.nextEffect.delay(this.options.waitingPeriod, this);
|
||||
break;
|
||||
case 2:
|
||||
this.steps = 0;
|
||||
this.imgEffect.start(1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.onDomReady(slideShow.init.bind(slideShow));
|
||||
*/
|
||||
var SlideShow = new Class({
|
||||
options: {
|
||||
id: 'SlideShow',
|
||||
startTransitionTime: 2000,
|
||||
waitingPeriod: 6000,
|
||||
transitionTime: 800
|
||||
},
|
||||
|
||||
initialize: function(el, options) {
|
||||
// init default options
|
||||
this.setOptions(options);
|
||||
this.container = el;
|
||||
this.buildScreen();
|
||||
|
||||
var nextEffect = this.nextEffect.bind(this);
|
||||
|
||||
this.imgEffect = this.container.effect('opacity', { duration: this.options.startTransitionTime, onComplete: nextEffect }).hide();
|
||||
this.steps = 0;
|
||||
this.nextEffect();
|
||||
|
||||
},
|
||||
buildScreen: function () {
|
||||
this.container.rel = this.container.getProperty('rel');
|
||||
this.container.srcs = this.container.getProperty('srcs');
|
||||
if (this.container.rel.test('^slideShow', 'i'))
|
||||
{
|
||||
var aDim = this.container.rel.match(/[0-9.]+(px|%)/g);
|
||||
var width = "500px";
|
||||
var height = "200px";
|
||||
if (aDim && aDim[0])
|
||||
{
|
||||
var w = aDim[0].toInt();
|
||||
if (w > 0)
|
||||
width = w;
|
||||
}
|
||||
if (aDim && aDim[1])
|
||||
{
|
||||
var h = aDim[1].toInt();
|
||||
if (h > 0)
|
||||
height = h;
|
||||
}
|
||||
this.container.setProperties({width:width, height:height});
|
||||
if (this.container.srcs)
|
||||
this.srcs = this.container.srcs.split(',');
|
||||
}
|
||||
},
|
||||
nextEffect: function () {
|
||||
switch (this.steps++)
|
||||
{
|
||||
case 0:
|
||||
if (this.showing)
|
||||
this.imgEffect.options.duration = this.options.transitionTime;
|
||||
if (!$defined(this.index))
|
||||
{
|
||||
this.index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.index++;
|
||||
if (this.index >= this.srcs.length)
|
||||
this.index = 0;
|
||||
var firstElem = this.container.getFirst();
|
||||
firstElem.remove();
|
||||
firstElem.setStyle('display', 'none');
|
||||
firstElem.injectInside(this.slidesContainer);
|
||||
}
|
||||
|
||||
var nextElem = $(this.srcs[this.index]);
|
||||
if (!$defined(this.slidesContainer))
|
||||
this.slidesContainer = nextElem.getParent();
|
||||
nextElem.injectInside(this.container);
|
||||
nextElem.setStyle('display', 'block');
|
||||
this.showing = true;
|
||||
this.imgEffect.start(0, 1);
|
||||
break;
|
||||
case 1:
|
||||
this.nextEffect.delay(this.options.waitingPeriod, this);
|
||||
break;
|
||||
case 2:
|
||||
this.steps = 0;
|
||||
this.imgEffect.start(1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
SlideShow.implement(new Options);
|
||||
120
wise-webapp/src/main/webapp/js/transcorners.js
Normal file
120
wise-webapp/src/main/webapp/js/transcorners.js
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/* transcorners : Yaroslaff Fedin (inviz.ru). updates : [url=http://forum.mootools.net/topic.php?id=1202]http://forum.mootools.net/topic.php?id=1202[/url] */
|
||||
|
||||
var Transcorner = new Class({
|
||||
setOptions: function(options) {
|
||||
this.options = Object.extend({
|
||||
radius: 10,
|
||||
borderColor: null,
|
||||
backgroundColor: this.el.getStyle('background-color'),
|
||||
transition: this.fx,
|
||||
onComplete: Class.empty
|
||||
}, options || {});
|
||||
}
|
||||
,initialize: function(el, sides, options) {
|
||||
this.el = $(el);
|
||||
if (!sides || $type(sides) == 'object') {
|
||||
options = sides || false;
|
||||
sides = 'top, bottom';
|
||||
}
|
||||
;
|
||||
this.setOptions(options);
|
||||
sides.split(',').each(function(side) {
|
||||
side = side.clean().test(' ') ? side.clean().split(' ') : [side.trim()];
|
||||
this.assemble(side[0], side[1]);
|
||||
}, this);
|
||||
}
|
||||
,fx: function(pos) {
|
||||
return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);
|
||||
}
|
||||
,assemble: function(vertical, horizontal) {
|
||||
var corner;
|
||||
var el = this.el;
|
||||
while ((el = el.getParent()) && el.getTag() != 'html' && [false, 'transparent'].test(corner = el.getStyle('background-color'))) {
|
||||
}
|
||||
;
|
||||
var s = function(property, dontParse) {
|
||||
return !dontParse ? (parseInt(this.el.getStyle(property)) || 0) : this.el.getStyle(property);
|
||||
}.bind(this);
|
||||
var sides = {
|
||||
left:'right',
|
||||
right:'left'
|
||||
};
|
||||
var styles = {
|
||||
display: 'block',
|
||||
backgroundColor: corner,
|
||||
zIndex: 1,
|
||||
position: 'relative',
|
||||
zoom: 1
|
||||
};
|
||||
for (side in sides) {
|
||||
styles['margin-' + side] = "-" + (s('padding-' + side) + s('border-' + side + '-width')) + "px";
|
||||
}
|
||||
for (side in {top:1, bottom:1}) {
|
||||
styles['margin-' + side] = vertical == side ? "0" : (s('padding-' + vertical) - this.options.radius) + "px";
|
||||
}
|
||||
var handler = new Element("b").setStyles(styles).addClass('corner-container');
|
||||
this.options.borderColor = this.options.borderColor || (s('border-' + vertical + '-width') > 0 ? s('border-' + vertical + '-color', 1) : this.options.backgroundColor);
|
||||
this.el.setStyle('border-' + vertical, '0').setStyle('padding-' + vertical, '0');
|
||||
var stripes = [];
|
||||
var borders = {};
|
||||
var exMargin = 0;
|
||||
for (side in sides) {
|
||||
borders[side] = s('border-' + side + '-width', 1) + " " + s('border-' + side + '-style', 1) + " " + s('border-' + side + '-color', 1);
|
||||
}
|
||||
for (var i = 1; i < this.options.radius; i++) {
|
||||
margin = Math.round(this.options.transition((this.options.radius - i) / this.options.radius) * this.options.radius);
|
||||
var styles = {
|
||||
background: i == 1 ? this.options.borderColor : this.options.backgroundColor,
|
||||
display: 'block',
|
||||
height: '1px',
|
||||
overflow: 'hidden',
|
||||
zoom: 1
|
||||
};
|
||||
for (side in sides) {
|
||||
var check = horizontal == sides[side];
|
||||
styles['border-' + side] = check ? borders[side] : (((exMargin || margin) - margin) || 1) + 'px solid ' + this.options.borderColor;
|
||||
styles['margin-' + side] = check ? 0 : margin + 'px';
|
||||
}
|
||||
;
|
||||
exMargin = margin;
|
||||
stripes.push(new Element("b").setStyles(styles).addClass('corner'));
|
||||
}
|
||||
;
|
||||
if (vertical == 'top') {
|
||||
this.el.insertBefore(handler, this.el.firstChild);
|
||||
}
|
||||
else {
|
||||
handler.injectInside(this.el);
|
||||
stripes = stripes.reverse();
|
||||
}
|
||||
;
|
||||
stripes.each(function(stripe) {
|
||||
stripe.injectInside(handler);
|
||||
});
|
||||
this.options.onComplete();
|
||||
}
|
||||
});
|
||||
Element.extend({
|
||||
makeRounded: function(side, options) {
|
||||
return new Transcorner(this, side, options);
|
||||
}
|
||||
});
|
||||
1473
wise-webapp/src/main/webapp/js/windoo.js
Normal file
1473
wise-webapp/src/main/webapp/js/windoo.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user