Skip to content

Commit

Permalink
修改视频的dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Mar 18, 2014
1 parent f2aaaad commit bb96d98
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions dialogs/video/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

me.lang = lang;
me.editor = editor;
me.$widget = $widget;
me.root().html( $.parseTmpl( me.tpl, $.extend( { video_url: video_url }, lang['static'] ) ) );

me.initController( lang );
Expand All @@ -48,7 +49,7 @@
initEvent:function(){

var me = this,
url = $("#eduiVideoUrl")[0];
url = $("#eduiVideoUrl", me.$widget)[0];

if( 'oninput' in url ) {
url.oninput = function(){
Expand All @@ -71,9 +72,9 @@

//编辑视频时初始化相关信息
if(img && img.className == "edui-faked-video"){
$("#eduiVideoUrl")[0].value = url = img.getAttribute("_url");
$("#eduiVideoWidth")[0].value = img.width;
$("#eduiVideoHeight")[0].value = img.height;
$("#eduiVideoUrl", me.$widget)[0].value = url = img.getAttribute("_url");
$("#eduiVideoWidth", me.$widget)[0].value = img.width;
$("#eduiVideoHeight", me.$widget)[0].value = img.height;
var align = domUtils.getComputedStyle(img,"float"),
parentAlign = domUtils.getComputedStyle(img.parentNode,"text-align");
me.updateAlignButton(parentAlign==="center"?"center":align);
Expand All @@ -93,10 +94,10 @@
conUrl = me.convert_url(url);

if(!me.endWith(conUrl,[".swf",".flv",".wmv"])){
$("#eduiVideoPreview").html( lang.urlError );
$("#eduiVideoPreview", me.$widget).html( lang.urlError );
return;
}
$("#eduiVideoPreview")[0].innerHTML = '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
$("#eduiVideoPreview", me.$widget)[0].innerHTML = '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
' src="' + url + '"' +
' width="' + 420 + '"' +
' height="' + 280 + '"' +
Expand All @@ -109,9 +110,9 @@
insertSingle: function(){

var me = this,
width = $("#eduiVideoWidth")[0],
height = $("#eduiVideoHeight")[0],
url=$('#eduiVideoUrl')[0].value,
width = $("#eduiVideoWidth", me.$widget)[0],
height = $("#eduiVideoHeight", me.$widget)[0],
url=$('#eduiVideoUrl', me.$widget)[0].value,
align = this.findFocus("eduiVideoFloat","name");

if(!url) return false;
Expand Down Expand Up @@ -178,7 +179,7 @@
return /(0|^[1-9]\d*$)/.test( value );
},
updateAlignButton: function( align ) {
var aligns = $( "#eduiVideoFloat" )[0].children;
var aligns = $( "#eduiVideoFloat", this.$widget )[0].children;

for ( var i = 0, ci; ci = aligns[i++]; ) {
if ( ci.getAttribute( "name" ) == align ) {
Expand All @@ -198,12 +199,11 @@
* @param ids
*/
createAlignButton: function( ids ) {

var lang = this.lang,
vidoe_home = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/video/';

for ( var i = 0, ci; ci = ids[i++]; ) {
var floatContainer = $( "#" + ci ) [0],
var floatContainer = $( "#" + ci, this.$widget ) [0],
nameMaps = {"none":lang['default'], "left":lang.floatLeft, "right":lang.floatRight};
for ( var j in nameMaps ) {
var div = document.createElement( "div" );
Expand All @@ -220,7 +220,7 @@
* 选择切换
*/
switchSelect: function( selectParentId ) {
var selects = $( "#" + selectParentId )[0].children;
var selects = $( "#" + selectParentId, this.$widget )[0].children;
for ( var i = 0, ci; ci = selects[i++]; ) {
$(ci).on("click", function () {
for ( var j = 0, cj; cj = selects[j++]; ) {
Expand All @@ -237,7 +237,7 @@
* @param returnProperty
*/
findFocus: function( id, returnProperty ) {
var tabs = $( "#" + id )[0].children,
var tabs = $( "#" + id , this.$widget)[0].children,
property;
for ( var i = 0, ci; ci = tabs[i++]; ) {
if ( ci.className=="edui-video-focus" ) {
Expand Down Expand Up @@ -265,8 +265,8 @@
height:498,
buttons: {
ok: {
exec: function( editor ){
$("#eduiVideoPreview").html("");
exec: function( editor, $w ){
$("#eduiVideoPreview", $w).html("");
editor.getWidgetData(widgetName).insertSingle();
}
},
Expand Down

0 comments on commit bb96d98

Please sign in to comment.