- this is a message box with many elements
-
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
- - item
-
diff --git a/js/faviconbuilder.coffee b/js/faviconbuilder.coffee
index b4c1b7b..568a513 100644
--- a/js/faviconbuilder.coffee
+++ b/js/faviconbuilder.coffee
@@ -94,6 +94,49 @@ class App.Utils.DefaultMenu
{label:"thickbox test",action:"showthickbox",title:"Show thick box , just a javascript CSS test , no special functionalities"}
]
+###
+class App.Utils.Iterator extends Array
+ constructor:->
+ @push i for i in arguments
+ @iter = 0
+ next:->
+ @[++@iter] if @iter < @length-1
+ previous:->
+ @[--@iter] if @iter>0
+ hasNext:->
+ if @[@iter+1]
+ true
+ else
+ false
+ hasPrevious:->
+ if @[@iter-1]
+ true
+ else
+ false
+###
+
+
+App.Utils.Iterator = do->
+ Iterator = ->
+ array = Array.apply(this,arguments)
+ iter = 0
+ return {
+ getArray:->
+ array
+ getValue:->
+ array[iter]
+ next:->
+ array[++iter] if iter < array.length-1
+ previous:->
+ array[--iter] if iter>0
+ hasNext:->
+ return if array[iter+1] then true else return false
+ hasPrevious:->
+ return if array[iter-1]then true else return false
+ }
+
+ return Iterator
+
### MODELS ###
class App.Models.Color
constructor:(@title="Eraser",@color=null,@alpha=1)->
@@ -312,8 +355,10 @@ class App.Views.Menu
render:->
@model.targetId.innerHTML = ""
for i in [0...@model.items.length]
- button = document.createElement("button")
- button.innerText = @model.items[i].label
+ button = document.createElement("input")
+ #button.innerText = @model.items[i].label
+ button.setAttribute("value",@model.items[i].label)
+ button.setAttribute("type","button")
button.setAttribute("id",@model.items[i].action)
button.setAttribute("title",@model.items[i].title)
button.dataset?= {}
@@ -336,6 +381,7 @@ class App.Controllers.Application
class Main
constructor:->
version = 0.1
+ @thickbox = document.getElementById("thickbox")
$target = document.getElementById("target")
$canvasPreview = document.getElementById("canvasPreview")
$colorSelector = document.getElementById("colorSelector")
@@ -428,5 +474,9 @@ class Main
@updateViews()
showThickbox:(e)=>
console.log e,"show thickbox"
+ @thickbox.style.visibility = if @thickbox.style.visibility == "hidden" then "visible" else "hidden"
+ @thickbox.style.opacity = if parseInt(@thickbox.style.opacity)<1 then 1 else 0
+ @thickbox.onclick= (e)=>
+ @showThickbox(e)
window?.onload = ->
window?.main = new Main()
diff --git a/js/faviconbuilder.js b/js/faviconbuilder.js
index 45c7aed..bfc5908 100644
--- a/js/faviconbuilder.js
+++ b/js/faviconbuilder.js
@@ -165,6 +165,65 @@ App.Utils.DefaultMenu = (function() {
})();
+/*
+class App.Utils.Iterator extends Array
+ constructor:->
+ @push i for i in arguments
+ @iter = 0
+ next:->
+ @[++@iter] if @iter < @length-1
+ previous:->
+ @[--@iter] if @iter>0
+ hasNext:->
+ if @[@iter+1]
+ true
+ else
+ false
+ hasPrevious:->
+ if @[@iter-1]
+ true
+ else
+ false
+*/
+
+App.Utils.Iterator = (function() {
+ var Iterator;
+ Iterator = function() {
+ var array, iter;
+ array = Array.apply(this, arguments);
+ iter = 0;
+ return {
+ getArray: function() {
+ return array;
+ },
+ getValue: function() {
+ return array[iter];
+ },
+ next: function() {
+ if (iter < array.length - 1) return array[++iter];
+ },
+ previous: function() {
+ if (iter > 0) return array[--iter];
+ },
+ hasNext: function() {
+ if (array[iter + 1]) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ hasPrevious: function() {
+ if (array[iter - 1]) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ };
+ };
+ return Iterator;
+})();
+
/* MODELS
*/
@@ -626,8 +685,9 @@ App.Views.Menu = (function() {
_this = this;
this.model.targetId.innerHTML = "";
for (i = 0, _ref = this.model.items.length; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
- button = document.createElement("button");
- button.innerText = this.model.items[i].label;
+ button = document.createElement("input");
+ button.setAttribute("value", this.model.items[i].label);
+ button.setAttribute("type", "button");
button.setAttribute("id", this.model.items[i].action);
button.setAttribute("title", this.model.items[i].title);
if (button.dataset == null) button.dataset = {};
@@ -683,6 +743,7 @@ Main = (function() {
this.clickcell = __bind(this.clickcell, this);
var $canvasPreview, $colorSelector, $factorSelector, $menu, $target, $title, defaultColor, title, version;
version = 0.1;
+ this.thickbox = document.getElementById("thickbox");
$target = document.getElementById("target");
$canvasPreview = document.getElementById("canvasPreview");
$colorSelector = document.getElementById("colorSelector");
@@ -803,7 +864,13 @@ Main = (function() {
};
Main.prototype.showThickbox = function(e) {
- return console.log(e, "show thickbox");
+ var _this = this;
+ console.log(e, "show thickbox");
+ this.thickbox.style.visibility = this.thickbox.style.visibility === "hidden" ? "visible" : "hidden";
+ this.thickbox.style.opacity = parseInt(this.thickbox.style.opacity) < 1 ? 1 : 0;
+ return this.thickbox.onclick = function(e) {
+ return _this.showThickbox(e);
+ };
};
return Main;