From 099fbc78805a89e40b150e133a2ff4d042b18512 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 16 Jun 2012 14:25:08 +0200 Subject: [PATCH] dont show Run tests is showTests is false, fix documentation example --- examples/documentation/js/example.js | 51 +++++++++++++++------------- examples/forms/js/example.js | 6 ++-- source/Ox.UI/js/Code/DocPanel.js | 4 ++- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/examples/documentation/js/example.js b/examples/documentation/js/example.js index f20c58ea..06dbadc4 100644 --- a/examples/documentation/js/example.js +++ b/examples/documentation/js/example.js @@ -28,8 +28,8 @@ My.MAGIC_CONSTANT Magic constant, needed for HTTP requests */ My.MAGIC_CONSTANT = navigator.userAgent.length % 2 == 0 ? 23 : 42; +Ox.load(function() { //@ Objects - /* */ /*@ @@ -77,35 +77,37 @@ My.favorites = (function() { keys = Object.keys(favorites); return Ox.extend(favorites, {any: favorites[keys[Ox.random(keys.length)]]}); }()); - /*@ replace ... 0 ... 1 replace */ -My.HTMLUtils = { - entities: { +My.HTMLUtils = (function() { + var entities = { '"': '"', '&': '&', "'": ''', '<': '<', '>': '>' - }, - replace: { - namedEntity: [ - new RegExp('(' + Ox.values(this.entities).join('|') + ')', 'g'), - function(match) { - return Ox.keyOf(this.entities, match); - } - ], - numericEntity: [ - /&#([0-9A-FX]+);/gi, - function(match, code) { - return Ox.char( - /^X/i.test(code) - ? parseInt(code.slice(1), 16) - : parseInt(code, 10) - ); - } - ], - } -}; + }; + return { + entities: entities, + replace: { + namedEntity: [ + new RegExp('(' + Ox.values(entities).join('|') + ')', 'g'), + function(match) { + return Ox.keyOf(entities, match); + } + ], + numericEntity: [ + /&#([0-9A-FX]+);/gi, + function(match, code) { + return Ox.char( + /^X/i.test(code) + ? parseInt(code.slice(1), 16) + : parseInt(code, 10) + ); + } + ], + } + }; +}()); /*@ My.defaultPlace Default place object @@ -274,6 +276,7 @@ My.localStorage = (function() { }; }()); +}); //@ Ox.load('UI', function() { var path = Ox.PATH + '../examples/documentation/js/'; diff --git a/examples/forms/js/example.js b/examples/forms/js/example.js index 548e74da..7b4dd863 100644 --- a/examples/forms/js/example.js +++ b/examples/forms/js/example.js @@ -5,7 +5,6 @@ This example demonstrates various form elements. 'use strict'; Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { - var countries = Ox.sortASCII(Ox.COUNTRIES.filter(function(country) { return !country.dissolved && !country.disputed && !country.exception; }).map(function(country) { @@ -692,6 +691,5 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { ], orientation: 'horizontal' }) - .appendTo(Ox.$body) - -}); \ No newline at end of file + .appendTo(Ox.$body); +}); diff --git a/source/Ox.UI/js/Code/DocPanel.js b/source/Ox.UI/js/Code/DocPanel.js index 01140a9d..f1060577 100644 --- a/source/Ox.UI/js/Code/DocPanel.js +++ b/source/Ox.UI/js/Code/DocPanel.js @@ -74,7 +74,9 @@ Ox.DocPanel = function(options, self) { self.$testsStatus = $('
') .css({marginTop: '5px', textAlign: 'center'}) .appendTo(self.$toolbar); - if (!self.options.results) { + if (!self.options.showTests) { + self.$testsStatus.hide(); + } else if (!self.options.results) { self.options.results = {}; self.$testsButton = Ox.Button({title: 'Run Tests'}) .css({margin: '4px auto'})