From 560df97101c6ce188e14db298923cca2c1d4dfe5 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 28 Feb 2013 14:08:08 +0000 Subject: [PATCH] update embed dialog (url parameter, properly show/hide additional advanced options) --- static/js/pandora/insertEmbedDialog.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/insertEmbedDialog.js b/static/js/pandora/insertEmbedDialog.js index b5319589..2326e2dc 100644 --- a/static/js/pandora/insertEmbedDialog.js +++ b/static/js/pandora/insertEmbedDialog.js @@ -1,6 +1,12 @@ 'use strict'; -pandora.ui.insertEmbedDialog = function(callback) { +pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) { + + if (arguments.length == 1) { + var url, callback = arguments[0]; + } else { + var url = arguments[0], callback = arguments[1]; + } var advanced = pandora.user.ui.showAdvancedEmbedOptions, dialogHeight = 344, @@ -103,7 +109,8 @@ pandora.ui.insertEmbedDialog = function(callback) { $input.url = Ox.Input({ label: 'URL', labelWidth: 128, - width: formWidth + width: formWidth, + value: url }) .bindEvent({ change: function(data) { @@ -324,7 +331,10 @@ pandora.ui.insertEmbedDialog = function(callback) { .addClass('advanced') .css({display: 'inline-block', margin: '4px 0'}) .bindEvent({ - change: formatURL + change: function() { + updateForm(); + formatURL(); + } }) .appendTo($form); @@ -355,7 +365,10 @@ pandora.ui.insertEmbedDialog = function(callback) { .addClass('advanced') .css({display: 'inline-block', margin: '4px 0'}) .bindEvent({ - change: formatURL + change: function() { + updateForm(); + formatURL(); + } }) .appendTo($form); @@ -389,11 +402,9 @@ pandora.ui.insertEmbedDialog = function(callback) { }) .appendTo($form); - formatURL(); + url ? parseURL() : formatURL(); updateForm(); - pandora.$$$input = $input - } else { // ...