Permalink
Browse files

third commit

  • Loading branch information...
1 parent 7faf6bb commit c27fb408d66dd6e06fbd7f1283439433dc6821ac @diverso committed Feb 28, 2013
Showing with 696 additions and 0 deletions.
  1. +46 −0 Parts/Button.js
  2. +33 −0 Parts/GlassButton.js
  3. +28 −0 Parts/InfoButton.js
  4. +141 −0 Parts/ScrollArea.js
  5. +126 −0 Parts/Shape.js
  6. +18 −0 Parts/Text.js
  7. +10 −0 Parts/license.txt
  8. +31 −0 Parts/setup.js
  9. +263 −0 Parts/utilities.js
View
@@ -0,0 +1,46 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+function CreateButton(elementOrID, spec)
+{
+ var buttonElement = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ buttonElement = document.getElementById(elementOrID);
+ }
+
+ if (!buttonElement.loaded) {
+ buttonElement.loaded = true;
+ while (buttonElement.firstChild) {
+ buttonElement.removeChild(buttonElement.firstChild);
+ }
+
+ var text = spec.text || '';
+ if (window.dashcode && dashcode.getLocalizedString) text = dashcode.getLocalizedString(text);
+
+ var leftImageWidth = spec.leftImageWidth || 0;
+ var rightImageWidth = spec.rightImageWidth || 0;
+ // when cloning template, get size from original
+ var styleElement = buttonElement;
+ if (spec.originalID) {
+ styleElement = document.getElementById(spec.originalID);
+ }
+ var imagePrefix = "Images/" + styleElement.id + "_";
+ var width = dashcode.getElementWidth(styleElement) || 20;
+ var height = dashcode.getElementHeight(styleElement) || 20;
+
+ var onclick = spec.onclick || null;
+ try { onclick = eval(onclick); } catch (e) { onclick = null; }
+
+ buttonElement.object = new AppleButton(buttonElement, text, height, imagePrefix + "left.png", imagePrefix + "left_clicked.png", leftImageWidth, imagePrefix + "middle.png", imagePrefix + "middle_clicked.png", imagePrefix + "right.png", imagePrefix + "right_clicked.png", rightImageWidth, onclick);
+ buttonElement.object.element = buttonElement;
+ buttonElement.object._container.childNodes.item(2).style.width = rightImageWidth + "px";
+ buttonElement.object.setEnabled(!spec.disabled);
+ buttonElement.object.textElement.style.width = (width - (leftImageWidth + rightImageWidth)) + "px";
+ }
+
+ return buttonElement.object;
+}
View
@@ -0,0 +1,33 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+function CreateGlassButton(elementOrID, spec)
+{
+ var buttonElement = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ buttonElement = document.getElementById(elementOrID);
+ }
+
+ if (!buttonElement.loaded) {
+ buttonElement.loaded = true;
+ while (buttonElement.firstChild) {
+ buttonElement.removeChild(buttonElement.firstChild);
+ }
+
+ var text = spec.text || '';
+ if (window.dashcode && dashcode.getLocalizedString) text = dashcode.getLocalizedString(text);
+
+ var onclick = spec.onclick || null;
+ try { onclick = eval(onclick); } catch (e) { onclick = null; }
+
+ buttonElement.object = new AppleGlassButton(buttonElement, text, onclick);
+ buttonElement.object.element = buttonElement;
+ buttonElement.object.setEnabled(!spec.disabled);
+ }
+
+ return buttonElement.object;
+}
View
@@ -0,0 +1,28 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+function CreateInfoButton(elementOrID, spec)
+{
+ var flipElement = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ flipElement = document.getElementById(elementOrID);
+ }
+ if (!flipElement.loaded) {
+ flipElement.loaded = true;
+ while (flipElement.firstChild) {
+ flipElement.removeChild(flipElement.firstChild);
+ }
+
+ var onclick = spec.onclick || null;
+ try { onclick = eval(onclick); } catch (e) { onclick = null; }
+
+ flipElement.object = new AppleInfoButton(flipElement, document.getElementById(spec.frontID), spec.foregroundStyle, spec.backgroundStyle, onclick);
+ flipElement.object.element = flipElement;
+ }
+
+ return flipElement.object;
+}
View
@@ -0,0 +1,141 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+function CreateScrollArea(elementOrID, spec)
+{
+ var scrollAreaElement = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ scrollAreaElement = document.getElementById(elementOrID);
+ }
+
+ if (!scrollAreaElement.loaded) {
+ var element = null;
+ var style = null;
+ var contentElement = null;
+ var verticalScrollbar = null;
+ var horizontalScrollbar = null;
+ var hasVerticalScrollbar = spec.hasVerticalScrollbar == undefined ? false : spec.hasVerticalScrollbar;
+ var hasHorizontalScrollbar = spec.hasHorizontalScrollbar == undefined ? false : spec.hasHorizontalScrollbar;
+ var autoHideScrollbars = spec.autoHideScrollbars == undefined ? false : spec.autoHideScrollbars;
+ var leftMargin = spec.leftMargin == undefined ? 0 : spec.leftMargin;
+ var rightMargin = spec.rightMargin == undefined ? 0 : spec.rightMargin;
+ var topMargin = spec.topMargin == undefined ? 0 : spec.topMargin;
+ var bottomMargin = spec.bottomMargin == undefined ? 0 : spec.bottomMargin;
+ var scrollbarMargin = spec.scrollbarMargin == undefined ? 0 : spec.scrollbarMargin;;
+ var leftScrollbarMargin = leftMargin + scrollbarMargin;
+ var rightScrollbarMargin = rightMargin + scrollbarMargin;
+ var topScrollbarMargin = topMargin + scrollbarMargin;
+ var bottomScrollbarMargin = bottomMargin + scrollbarMargin;
+ var spacing = spec.spacing == undefined ? 0 : spec.spacing;
+ var scrollbarSize = spec.scrollbarDivSize == undefined ? 0 : spec.scrollbarDivSize;;
+
+ // Associate or create the content area element
+ var childIndex;
+ for (childIndex=0; childIndex<scrollAreaElement.childNodes.length; childIndex++) {
+ var child = scrollAreaElement.childNodes[childIndex];
+ if (child.nodeType == Node.ELEMENT_NODE) {
+ contentElement = child;
+ break;
+ }
+ }
+ // Remove all other child elements
+ while (scrollAreaElement.childNodes.length > childIndex+1) {
+ scrollAreaElement.removeChild(scrollAreaElement.lastChild);
+ }
+ if (contentElement == null || contentElement == undefined) {
+ contentElement = document.createElement("div");
+ }
+
+ style = contentElement.style;
+ style.position = "absolute";
+ style.left = leftMargin + "px";
+ style.top = topMargin + "px";
+
+ if (hasVerticalScrollbar && hasHorizontalScrollbar) {
+ style.right = rightMargin + scrollbarSize + spacing + "px";
+ style.bottom = bottomMargin + scrollbarSize + spacing + "px";
+ } else if (hasVerticalScrollbar) {
+ style.right = rightMargin + scrollbarSize + spacing + "px";
+ style.bottom = bottomMargin + "px";
+ } else if (hasHorizontalScrollbar) {
+ style.right = rightMargin + "px";
+ style.bottom = bottomMargin + scrollbarSize + spacing + "px";
+ } else {
+ style.right = rightMargin + "px";
+ style.bottom = bottomMargin + "px";
+ }
+ scrollAreaElement.appendChild(contentElement);
+ scrollAreaElement.contentElement = contentElement;
+ scrollAreaElement.content = contentElement;
+
+ // Create the vertical scroll bar
+ if (hasVerticalScrollbar) {
+ element = document.createElement("div");
+ element.className = "apple-no-children apple-remove";
+ style = element.style;
+ style.position = "absolute";
+ style.width = scrollbarSize + "px";
+ style.height = "auto";
+ style.right = rightMargin + "px";
+ style.top = topScrollbarMargin + "px";
+ style.bottom = hasHorizontalScrollbar ? bottomScrollbarMargin + scrollbarSize + "px" : bottomScrollbarMargin + "px";
+ style.appleDashboardRegion = "none";
+ scrollAreaElement.appendChild(element);
+ verticalScrollbar = new AppleVerticalScrollbar(element);
+ scrollAreaElement.verticalScrollbarElement = element;
+ }
+
+ // Create the horizontal scroll bar
+ if (hasHorizontalScrollbar) {
+ element = document.createElement("div");
+ element.className = "apple-no-children apple-remove";
+ style = element.style;
+ style.position = "absolute";
+ style.width = "auto";
+ style.height = scrollbarSize + "px";
+ style.left = leftScrollbarMargin + "px";
+ style.right = hasVerticalScrollbar ? rightScrollbarMargin + scrollbarSize + "px" : rightScrollbarMargin + "px";
+ style.bottom = bottomMargin + "px";
+ style.appleDashboardRegion = "none";
+ scrollAreaElement.appendChild(element);
+ horizontalScrollbar = new AppleHorizontalScrollbar(element);
+ scrollAreaElement.horizontalScrollbarElement = element;
+ }
+
+ // Create the scroll area
+ if (hasVerticalScrollbar && hasHorizontalScrollbar) {
+ scrollAreaElement.object = new AppleScrollArea(contentElement, verticalScrollbar, horizontalScrollbar);
+ } else if (hasVerticalScrollbar) {
+ scrollAreaElement.object = new AppleScrollArea(contentElement, verticalScrollbar);
+ } else if (hasHorizontalScrollbar) {
+ scrollAreaElement.object = new AppleScrollArea(contentElement, horizontalScrollbar);
+ } else {
+ scrollAreaElement.object = new AppleScrollArea(contentElement);
+ }
+ scrollAreaElement.object.element = scrollAreaElement;
+
+ // Adjust the auto hide setting
+ if (verticalScrollbar) {
+ verticalScrollbar.setAutohide(autoHideScrollbars);
+ }
+ if (horizontalScrollbar) {
+ horizontalScrollbar.setAutohide(autoHideScrollbars);
+ }
+
+ scrollAreaElement.object.contentElement = contentElement;
+ scrollAreaElement.object.content = contentElement;
+ if (spec.originalID) {
+ // when cloning template, refresh shortly after initialized
+ var self = scrollAreaElement;
+ window.setTimeout(function() {self.object.refresh();}, 0);
+ } else {
+ scrollAreaElement.object.refresh();
+ }
+ }
+
+ return scrollAreaElement.object;
+}
View
@@ -0,0 +1,126 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+// Note: Properties and methods beginning with underbar ("_") are considered private and subject to change in future Dashcode releases.
+
+function CreateShape(elementOrID, spec)
+{
+ var shapeElement = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ shapeElement = document.getElementById(elementOrID);
+ }
+ if (!shapeElement.loaded) {
+ shapeElement.loaded = true;
+ // when cloning template, get size from original
+ var styleElement = shapeElement;
+ if (spec.originalID) {
+ styleElement = document.getElementById(spec.originalID);
+ }
+ var prefix = "Images/" + styleElement.id + "_";
+ var height = dashcode.getElementHeight(styleElement) || 20;
+ var leftImageWidth = spec.leftImageWidth || 0;
+ var rightImageWidth = spec.rightImageWidth || 0;
+ shapeElement.object = new Shape(shapeElement, height, leftImageWidth, rightImageWidth, prefix + "left.png", prefix + "middle.png", prefix + "right.png");
+
+ return shapeElement.object;
+ }
+}
+
+function Shape(shape, height, leftImageWidth, rightImageWidth, imgLeft, imgMiddle, imgRight)
+{
+ this._init(shape, height, leftImageWidth, rightImageWidth, imgLeft, imgMiddle, imgRight);
+}
+
+Shape.prototype.remove = function()
+{
+ var parent = this._container.parentNode;
+ parent.removeChild(this._container);
+}
+
+Shape.prototype._init = function(shape, height, leftImageWidth, rightImageWidth, imgLeft, imgMiddle, imgRight)
+{
+ if (shape) {
+ this.element = shape;
+ this._imgLeftPath = imgLeft;
+ this._imgMiddlePath = imgMiddle;
+ this._imgRightPath = imgRight;
+
+ var style = null;
+ var element = null;
+
+ while (shape.firstChild) {
+ shape.removeChild(shape.firstChild);
+ }
+ var container = document.createElement("div");
+ this._container = container;
+
+ shape.appendChild(container);
+
+ // Create the inner elements
+ var element = document.createElement("div");
+ var style = element.style;
+ style.position = "absolute";
+ style.display = "inline-block";
+ style.background = "url(" + this._imgLeftPath + ") no-repeat top left";
+ style.height = height + "px";
+ style.width = leftImageWidth + "px";
+ container.appendChild(element);
+
+ element = document.createElement("div");
+ style = element.style;
+ style.position = "absolute";
+ style.display = "inline-block";
+ style.backgroundRepeat = "repeat-x";
+ style.backgroundImage = "url(" + this._imgMiddlePath + ")";
+ style.lineHeight = height + "px";
+ style.height = height + "px";
+ style.left = leftImageWidth + "px";
+ style.right = rightImageWidth + "px";
+ style.overflow = "hidden";
+ style.width = "auto";
+ style.whiteSpace = "nowrap";
+ container.appendChild(element);
+
+ element = document.createElement("div");
+ style = element.style;
+ style.position = "absolute";
+ style.display = "inline-block";
+ style.background = "url(" + this._imgRightPath + ") no-repeat top left";
+ style.height = height + "px";
+ style.width = rightImageWidth + "px";
+ style.right = 0 + "px";
+ container.appendChild(element);
+
+ style = container.style;
+ style.left = 0;
+ style.right = 0;
+ style.width = "auto";
+ style.height = height + "px";
+ }
+}
+
+Shape.prototype._updateImages = function(height, leftImageWidth, rightImageWidth)
+{
+ this._container.style.height = height + "px";
+
+ var leftDiv = this._container.children[0];
+ leftDiv.style.background = "url(" + this._imgLeftPath + ") no-repeat top left";
+ leftDiv.style.height = height + "px";
+ leftDiv.style.width = leftImageWidth + "px";
+
+ var middleDiv = this._container.children[1];
+ middleDiv.style.backgroundImage = "url(" + this._imgMiddlePath + ")";
+ middleDiv.style.height = height + "px";
+ middleDiv.style.left = leftImageWidth + "px";
+ middleDiv.style.right = rightImageWidth + "px";
+
+ var rightDiv = this._container.children[2];
+ rightDiv.style.background = "url(" + this._imgRightPath + ") no-repeat top left";
+ rightDiv.style.height = height + "px";
+ rightDiv.style.width = rightImageWidth + "px";
+ rightDiv.style.right = 0 + "px";
+}
View
@@ -0,0 +1,18 @@
+/*
+ This file was generated by Dashcode and is covered by the
+ license.txt included in the project. You may edit this file,
+ however it is recommended to first turn off the Dashcode
+ code generator otherwise the changes will be lost.
+ */
+
+function CreateText(elementOrID, spec)
+{
+ var text = spec.text || '';
+ if (window.dashcode && dashcode.getLocalizedString) text = dashcode.getLocalizedString(text);
+
+ var element = elementOrID;
+ if (elementOrID.nodeType != Node.ELEMENT_NODE) {
+ element = document.getElementById(elementOrID);
+ }
+ element.innerText = text;
+}
Oops, something went wrong.

0 comments on commit c27fb40

Please sign in to comment.