$ ->\r
+ _.templateSettings = {\r
+ interpolate: /\<\&\=(.+?)\&\>/g,\r
+ evaluate: /\<\&(.+?)\&\>/g\r
+ }\r
+ #filer = new Filer('tt', ['ea','eb','ec'])\r
+ #view = new FilerView( { filer: filer } )\r
confirm_confirm_confirm = () ->\r
confirm( )\r
editor = window.PettanrEditor\r
- configurations = window.configurations\r
+ manifest = {\r
+ items: window.items,\r
+ controllers: window.controllers,\r
+ models: window.models,\r
+ system_resources: window.system_resources,\r
+ magic_numbers: window.magic_numbers,\r
+ }\r
+ local_manifest = {\r
+ list_groups: window.list_groups,\r
+ profilers: window.profilers,\r
+ filers: window.filers,\r
+ forms: window.forms,\r
+ }\r
+ j = JSON.stringify(manifest, undefined, 2)\r
+ $('#pettanr-manifest').val(j)\r
+ j = JSON.stringify(local_manifest, undefined, 2)\r
+ $('#pettanr-local_manifest').val(j)\r
WritingFormat = window.PettanrWritingFormat\r
WritingFormat.load($('#writing_formats'))\r
SpeechBalloonTemplate = window.PettanrSpeechBalloonTemplate\r
v.add_helper( n, '' )\r
PictureSizeHelper = window.PettanrPictureSizeHelper\r
ColorHelper = window.PettanrColorHelper\r
+ PopupHelper = window.PettanrPopupHelper\r
\r
+ #panel = new Panel\r
+ #pp = new PanelPicture\r
+ #pp.set_panel(panel)\r
+ #confirm( PanelPicture.test() )\r
+ #confirm( pp.test() )\r
find_configurations = ( hash, key) ->\r
if typeof(hash[key]) == 'string'\r
find_configurations(hash, hash[key])\r
if Object.keys(rules).length > 0\r
v = form.validate({ignore:[],rules: rules})\r
\r
+ display_panel = (panel, vis) ->\r
+ v = if vis\r
+ ''\r
+ else\r
+ 'none'\r
+ trace = editor.panel_tag_id(panel)\r
+ $(trace).css('display', v)\r
+ \r
validate_panel = (form) ->\r
valid = form.valid()\r
bc = if valid\r
'#ef29ef'\r
$('a', $('#tabs-1-tab')).map ->\r
$(@).css('background-color', bc)\r
+ display_panel(form, valid)\r
valid\r
\r
display_element = (element, vis) ->\r
- v = if vis\r
+ trace = editor.element_tag_id(element)\r
+ d = $(trace + '_destroy').val()\r
+ v = if vis and d.length < 1\r
''\r
else\r
'none'\r
- trace = editor.element_tag_id(element)\r
switch element.attr('element_type')\r
when 'panel_picture'\r
trace = trace + 'div'\r
\r
# panel picture\r
PictureSizeHelper.add_helper()\r
+ PopupHelper.add_helper()\r
\r
$('.pettanr-panel-picture-wrapper').map ->\r
$(@).draggable {\r
\r
\r
# ground-picture\r
+ refresh_ground_picture = (element_trace) ->\r
+ x = parseInt($(element_trace + 'x').val()).toString() + 'px'\r
+ y = parseInt($(element_trace + 'y').val()).toString() + 'px'\r
+ $(element_trace).css('background-position', x + ' ' + y)\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_picture', $(@))\r
- $(@).focusout ->\r
- switch $(@).attr('column')\r
- when 'x', 'y'\r
+ switch $(@).attr('column')\r
+ when 'x', 'y'\r
+ $(@).focusout ->\r
trace = editor.element_tag_id($(@))\r
- x = parseInt($(trace + 'x').val()).toString() + 'px'\r
- y = parseInt($(trace + 'y').val()).toString() + 'px'\r
- $(trace).css('background-position', x + ' ' + y)\r
+ refresh_ground_picture(trace)\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_picture(trace)\r
+ }\r
$('select').map ->\r
if editor.element_is('ground_picture', $(@))\r
$(@).change ->\r
# ground_color\r
ColorHelper.add_helper($('.ground_color-code-wrap'), 'code')\r
\r
+ refresh_ground_color = (element_trace) ->\r
+ orientation = parseInt( $(element_trace + 'orientation').val() )\r
+ xy = $(element_trace + 'xy').val()\r
+ wh = $(element_trace + 'wh').val()\r
+ div_offset = if xy\r
+ xy\r
+ else\r
+ 0\r
+ div_size = if wh\r
+ wh\r
+ else\r
+ 100 - div_offset\r
+ div_x = if orientation == 0\r
+ 0\r
+ else\r
+ div_offset\r
+ div_y = if orientation == 0\r
+ div_offset\r
+ else\r
+ 0\r
+ div_width = if orientation == 0\r
+ 100\r
+ else\r
+ div_size\r
+ div_height = if orientation == 0\r
+ div_size\r
+ else\r
+ 100\r
+ div = $(element_trace)\r
+ div.css('left', div_x.toString() + '%')\r
+ div.css('top', div_y.toString() + '%')\r
+ div.css('width', div_width.toString() + '%')\r
+ div.css('height', div_height.toString() + '%')\r
+ \r
# sync view \r
$('input').map ->\r
if editor.element_is('ground_color', $(@))\r
- if $(@).attr('column') == 'code'\r
- $(@).hide()\r
+ switch $(@).attr('column')\r
+ when 'code'\r
+ $(@).hide()\r
+ when 'xy', 'wh'\r
+ $(@).spinner {\r
+ stop: ( event, ui ) ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ , min: 0\r
+ , max: 100\r
+ }\r
+ $(@).focusout ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
+ \r
+ $('select').map ->\r
+ if editor.element_is('ground_color', $(@))\r
+ switch $(@).attr('column')\r
+ when 'orientation'\r
+ $(@).change ->\r
+ trace = editor.element_tag_id($(@))\r
+ refresh_ground_color(trace)\r
\r
update_t = (ultrace) -> \r
t = 0\r
$('.new-element').map ->\r
$(@).click -> \r
false\r
- j = JSON.stringify(window.configurations)\r
- $('#pettanr-configurations').val(j)\r
\r