'+(i+1),'
'+val);
+ });
+ c.find('.list-index').width(c.find('.list-index').last().width());
+ c.find('.list-item').width(c.width()-c.find('.list-index').width()-15);
+ var s = this.scrollbar.height(c.height());
+ s.children('.list-scrollbar').height(s.height()/c[0].scrollHeight*s.height()).css('display', s.children('.list-scrollbar').height()===c.height() ? 'none' : 'inline-block');
+ this.el.find('.list-length').text('length: '+this.contents.length);
+};
+
+List.prototype.updateLayer = function() {
+ this.el.css('z-index', this.z);
+};
+
diff --git a/js/primitives/VarListPrims.js b/js/primitives/VarListPrims.js
index 065be7d..a8f734a 100644
--- a/js/primitives/VarListPrims.js
+++ b/js/primitives/VarListPrims.js
@@ -34,6 +34,8 @@ VarListPrims.prototype.addPrimsTo = function(primTable) {
primTable['lineCountOfList:'] = this.primListLength;
primTable['getLine:ofList:'] = this.primListGetLine;
primTable['list:contains:'] = this.primListContains;
+ primTable['hideList:'] = this.primHideList;
+ primTable['showList:'] = this.primShowList;
};
// Variable primitive implementations
@@ -74,9 +76,9 @@ VarListPrims.prototype.primChangeVar = function(b) {
};
VarListPrims.prototype.primHideVar = function(b) {
- var targetVar = interp.arg(b, 0);
+ var targetVar = interp.arg(b, 0), targetSprite = interp.targetSprite().objName;
for (var r = 0; r < runtime.reporters.length; r++) {
- if (runtime.reporters[r].cmd == 'getVar:' && runtime.reporters[r].param == targetVar) {
+ if (runtime.reporters[r].cmd == 'getVar:' && runtime.reporters[r].param == targetVar && (runtime.reporters[r].target == targetSprite || runtime.reporters[r].target == 'Stage')) {
runtime.reporters[r].visible = false;
return;
}
@@ -84,9 +86,9 @@ VarListPrims.prototype.primHideVar = function(b) {
};
VarListPrims.prototype.primShowVar = function(b) {
- var targetVar = interp.arg(b, 0);
+ var targetVar = interp.arg(b, 0), targetSprite = interp.targetSprite().objName;
for (var r = 0; r < runtime.reporters.length; r++) {
- if (runtime.reporters[r].cmd == 'getVar:' && runtime.reporters[r].param == targetVar) {
+ if (runtime.reporters[r].cmd == 'getVar:' && runtime.reporters[r].param == targetVar && (runtime.reporters[r].target == targetSprite || runtime.reporters[r].target == 'Stage')) {
runtime.reporters[r].visible = true;
return;
}
@@ -96,7 +98,7 @@ VarListPrims.prototype.primShowVar = function(b) {
// List primitive implementations
// Take a list name and target sprite and return the JS list itself
-var findList = function(targetSprite, listName) {
+function findList(targetSprite, listName) {
if (targetSprite == null) targetSprite = runtime.stage;
if (listName in targetSprite.lists) {
return targetSprite.lists[listName].contents;
@@ -104,7 +106,7 @@ var findList = function(targetSprite, listName) {
return runtime.stage.lists[listName].contents;
}
return null;
-};
+}
VarListPrims.prototype.primReadList = function(b) {
var list = findList(interp.targetSprite(), interp.arg(b, 0));
@@ -181,3 +183,23 @@ VarListPrims.prototype.primListContains = function(b) {
if (parseFloat(searchItem) == searchItem) searchItem = parseFloat(searchItem);
return $.inArray(searchItem, list) > -1;
};
+
+VarListPrims.prototype.primHideList = function(b) {
+ var targetList = interp.arg(b, 0), targetSprite = interp.targetSprite().objName;
+ for (var r = 0; r < runtime.reporters.length; r++) {
+ if (runtime.reporters[r] instanceof List && runtime.reporters[r].listName == targetList && (runtime.reporters[r].target == targetSprite || runtime.reporters[r].target == 'Stage')) {
+ runtime.reporters[r].visible = false;
+ return;
+ }
+ }
+};
+
+VarListPrims.prototype.primShowList = function(b) {
+ var targetList = interp.arg(b, 0), targetSprite = interp.targetSprite().objName;
+ for (var r = 0; r < runtime.reporters.length; r++) {
+ if (runtime.reporters[r] instanceof List && runtime.reporters[r].listName == targetList && (runtime.reporters[r].target == targetSprite || runtime.reporters[r].target == 'Stage')) {
+ runtime.reporters[r].visible = true;
+ return;
+ }
+ }
+};
diff --git a/player.css b/player.css
index f72db80..f2b13ae 100644
--- a/player.css
+++ b/player.css
@@ -92,6 +92,95 @@
position: absolute;
}
+/* List watcher styles */
+.list {
+ float: left;
+ border-radius: 7px;
+ -webkit-border-radius: 7px;
+ -moz-border-radius: 7px;
+ border-style: solid;
+ border-color: gray;
+ border-width: 2px;
+ background-color: #C1C4C7;
+ padding-left: 3px;
+ font: bold 11px sans-serif;
+ position: absolute;
+}
+
+.list .list-title {
+ padding-top: 2px;
+ text-align: center;
+ color: black;
+ font-weight: bold;
+ margin-bottom: 4px;
+}
+
+.list .list-scrollbar-container {
+ float: right;
+ width: 10px;
+ position: relative;
+}
+
+.list .list-scrollbar {
+ position: absolute;
+ top: 0px;
+ width: 10px;
+ background-color: #a8aaad;
+ border-radius: 10px;
+}
+
+.list .list-index {
+ color: rgb(81, 81, 81);
+ float: left;
+ padding: 2px;
+ margin-top: 0px;
+ text-align: right;
+ font: bold 11px;
+}
+
+.list .list-item {
+ float: right;
+ height: 16px;
+ overflow: hidden;
+ margin-bottom: 0px;
+ margin-right: 2px;
+ padding-top: 2px;
+ padding-left: 5px;
+ border-color: white;
+ border-style: solid;
+ border-width: 1px;
+ border-radius: 4px;
+ background-color: #cc5b22;
+ color: white;
+ word-wrap: break-word;
+ font: bolder 11px sans-serif;
+}
+
+.list .list-add {
+ clear: both;
+ background-color: #dedede;
+ width: 12px;
+ height: 12px;
+ border-radius: 12px;
+ color: #707070;
+ font: bold 10px sans-serif;
+ text-align: center;
+ position: absolute;
+ bottom: 2px;
+ left: 2px;
+}
+
+.list .list-length {
+ font-size: 10px;
+ font-weight: normal;
+ text-align: center;
+ color: black;
+ position: absolute;
+ bottom: 2px;
+ left: 0px;
+ right: 0px;
+}
+
/* Say/think bubble styles */
.bubble-container {
position: absolute;
@@ -138,3 +227,4 @@
background: url(img/think-bottom.png) transparent no-repeat;
}
+