forked from Botanical/BotanJS
Removed unused js
This commit is contained in:
parent
f20d0b9773
commit
f8722a3359
@ -1,213 +0,0 @@
|
|||||||
(function ()
|
|
||||||
{
|
|
||||||
var ns = __namespace( "Astro.Blog.AstroEdit.Visualizer.Snippet" );
|
|
||||||
|
|
||||||
/** @type {System.utils.IKey} */
|
|
||||||
var IKey = __import( "System.utils.IKey" );
|
|
||||||
/** @type {System.utils.DataKey} */
|
|
||||||
var DataKey = __import( "System.utils.DataKey" );
|
|
||||||
/** @type {Dandelion.IDOMElement} */
|
|
||||||
var IDOMElement = __import( "Dandelion.IDOMElement" );
|
|
||||||
/** @type {Dandelion} */
|
|
||||||
var Dand = __import( "Dandelion" );
|
|
||||||
/** @type {Components.MessageBox} */
|
|
||||||
var MessageBox = __import( "Components.MessageBox" );
|
|
||||||
|
|
||||||
var compileProp = ns[ NS_INVOKE ]( "compileProp" );
|
|
||||||
|
|
||||||
var swf = function (insertSnippet, snippetWrap, createContext, override)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
temp, i, j
|
|
||||||
|
|
||||||
// Pending
|
|
||||||
, defaultArt = ""
|
|
||||||
|
|
||||||
, handler = function ()
|
|
||||||
{
|
|
||||||
// Input fields
|
|
||||||
var input_w = Dand.wrapna("input", new IKey("type", "number"))
|
|
||||||
, input_h = Dand.wrapna("input", new IKey("type", "number"))
|
|
||||||
, input_title = Dand.wrap("input", null, "v_snippet_input_single", null, [new IKey("type", "text"), new IKey("placeHolder", "optional")] )
|
|
||||||
, input_desc = Dand.wrap("input", null, "v_snippet_input_single", null, [new IKey("type", "text"), new IKey("placeHolder", "optional")] )
|
|
||||||
, input_api = Dand.wrapna("input", new IKey("type", "checkbox"))
|
|
||||||
, input_preview = Dand.wrap("input", null, "v_snippet_input_single", null, [new IKey("type", "text"), new IKey("placeHolder", "optional")] )
|
|
||||||
, input_src = Dand.wrap("input", null, "v_snippet_input_single", null, new IKey("type", "text"))
|
|
||||||
, stage = this._stage;
|
|
||||||
|
|
||||||
if (stage)
|
|
||||||
{
|
|
||||||
input_src.value = this._src;
|
|
||||||
input_w.value = this._width;
|
|
||||||
input_h.value = this._height;
|
|
||||||
input_title.value = this._title;
|
|
||||||
input_desc.value = this._desc;
|
|
||||||
input_preview.value = this._preview;
|
|
||||||
input_api.checked = (this._extAPI == "on");
|
|
||||||
}
|
|
||||||
|
|
||||||
new MessageBox(
|
|
||||||
"Insert swf object",
|
|
||||||
Dand.wrape([
|
|
||||||
Dand.wrape([Dand.textNode("Dimensions: "), input_w, Dand.textNode("\u00D7"), input_h, Dand.textNode("px")])
|
|
||||||
|
|
||||||
, Dand.wrapc("v_instruction flsf", "Title:")
|
|
||||||
, input_title
|
|
||||||
|
|
||||||
, Dand.wrapc("v_instruction flsf", "Description:")
|
|
||||||
, input_desc
|
|
||||||
|
|
||||||
, Dand.wrapc("v_instruction flsf", "Preview image:")
|
|
||||||
, input_preview
|
|
||||||
|
|
||||||
, Dand.wrapc("v_instruction flsf", "Link to swf:")
|
|
||||||
, input_src
|
|
||||||
|
|
||||||
, Dand.wrape( Dand.wrapne( "label", [ input_api, "Use external API" ] ) )
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, "OK", "Cancel", visualizer.bind({src:input_src, width:input_w, height:input_h, title: input_title, desc: input_desc, extAPI: input_api, preview: input_preview, stage: this._stage})).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
, visualizer = function (submitted, override)
|
|
||||||
{
|
|
||||||
var src, width, height, title, desc, preview, extAPI
|
|
||||||
, stage = this.stage;
|
|
||||||
|
|
||||||
if (override)
|
|
||||||
{
|
|
||||||
src = override.value;
|
|
||||||
width = override.width;
|
|
||||||
height = override.height;
|
|
||||||
title = override.title;
|
|
||||||
desc = override.desc;
|
|
||||||
preview = override.preview;
|
|
||||||
extAPI = override.useExtAPI;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
src = this.src.value;
|
|
||||||
width = this.width.value;
|
|
||||||
height = this.height.value;
|
|
||||||
title = this.title.value;
|
|
||||||
desc = this.desc.value;
|
|
||||||
preview = this.preview.value;
|
|
||||||
extAPI = this.extAPI.checked ? "on" : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (submitted && width && height && src)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!stage)
|
|
||||||
{
|
|
||||||
// Visualize component
|
|
||||||
|
|
||||||
temp = Dand.wrapc("v_box"
|
|
||||||
, Dand.wrapc("v_description"
|
|
||||||
, [
|
|
||||||
Dand.wrap("span", null, "fls", title)
|
|
||||||
, Dand.textNode(" ")
|
|
||||||
, Dand.wrap("span", null, "v_caption_desc flsf", desc)
|
|
||||||
]
|
|
||||||
, new IKey("style", "font-size: 2em")
|
|
||||||
)
|
|
||||||
, [
|
|
||||||
new DataKey("value", src)
|
|
||||||
, new DataKey("width", width)
|
|
||||||
, new DataKey("height", height)
|
|
||||||
, new DataKey("title", title)
|
|
||||||
, new DataKey("desc", desc)
|
|
||||||
, new DataKey("preview", preview)
|
|
||||||
, new DataKey("useExtAPI", extAPI)
|
|
||||||
|
|
||||||
, new IKey
|
|
||||||
(
|
|
||||||
"style"
|
|
||||||
, "background-position: center; background-repeat: no-repeat; "
|
|
||||||
+ "width: " + width +"px; height: " + height + "px; "
|
|
||||||
+ "background-image: url(" + (preview ? preview : defaultArt) + ")"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
insertSnippet(j = snippetWrap("Swf", temp), Boolean(override));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IDOMElement(stage).setAttribute
|
|
||||||
(
|
|
||||||
[
|
|
||||||
new DataKey("value", src)
|
|
||||||
, new DataKey("width", width)
|
|
||||||
, new DataKey("height", height)
|
|
||||||
, new DataKey("title", title)
|
|
||||||
, new DataKey("desc", desc)
|
|
||||||
, new DataKey("preview", preview)
|
|
||||||
, new DataKey("useExtAPI", extAPI)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
stage.style.width = width + "px";
|
|
||||||
stage.style.height = height + "px";
|
|
||||||
stage.style.backgroundImage = "url(" + (preview ? preview : defaultArt) + ")";
|
|
||||||
|
|
||||||
// Title
|
|
||||||
temp = stage.firstChild.firstChild;
|
|
||||||
temp.removeChild(temp.firstChild);
|
|
||||||
temp.appendChild(Dand.textNode(title));
|
|
||||||
|
|
||||||
// Desc
|
|
||||||
temp = stage.firstChild.lastChild;
|
|
||||||
temp.removeChild(temp.firstChild);
|
|
||||||
temp.appendChild(Dand.textNode(desc));
|
|
||||||
|
|
||||||
temp = stage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
i = {
|
|
||||||
_src: src
|
|
||||||
, _width: width
|
|
||||||
, _height: height
|
|
||||||
, _title: title
|
|
||||||
, _desc: desc
|
|
||||||
, _preview: preview
|
|
||||||
, _extAPI: extAPI || "off"
|
|
||||||
, _stage: temp
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set context menu
|
|
||||||
createContext(i, j, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
if (override)
|
|
||||||
{
|
|
||||||
visualizer(true, override);
|
|
||||||
override = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
var compile = function (stage)
|
|
||||||
{
|
|
||||||
// [swf width="" height="" title="" desc="" preview="" useExtAPI="" ]src[/swf];
|
|
||||||
var element = IDOMElement(stage)
|
|
||||||
, props = ["width", "height", "title", "desc", "preview", "useExtAPI"];
|
|
||||||
|
|
||||||
return "[swf"
|
|
||||||
+ compileProp( element, props )
|
|
||||||
+ "]"
|
|
||||||
+ element.getDAttribute("value")
|
|
||||||
+ "[/swf]"
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
__static_method( swf, "compile", compile );
|
|
||||||
|
|
||||||
ns[ NS_EXPORT ]( EX_CLASS, "Swf", swf );
|
|
||||||
})();
|
|
@ -32,7 +32,6 @@
|
|||||||
, "Sound" , "background: YellowGreen;"
|
, "Sound" , "background: YellowGreen;"
|
||||||
, "Video" , "background: Crimson;"
|
, "Video" , "background: Crimson;"
|
||||||
, "Spoiler" , "background: cornflowerblue;"
|
, "Spoiler" , "background: cornflowerblue;"
|
||||||
, "Swf" , "background: #333;"
|
|
||||||
, "Link" , "background: blue;"
|
, "Link" , "background: blue;"
|
||||||
, "AcquireLib" , "background: black;"
|
, "AcquireLib" , "background: black;"
|
||||||
, "Html" , "background: coral;"
|
, "Html" , "background: coral;"
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/** @constructor */
|
|
||||||
Components.Mouse.Clipboard.SwfHelperObj = function() {};
|
|
||||||
|
|
||||||
/** @type {Function} */
|
|
||||||
Components.Mouse.Clipboard.SwfHelperObj.dummy;
|
|
||||||
/** @type {Function} */
|
|
||||||
Components.Mouse.Clipboard.SwfHelperObj.debug;
|
|
||||||
/** @type {Function} */
|
|
||||||
Components.Mouse.Clipboard.SwfHelperObj.copy;
|
|
Loading…
Reference in New Issue
Block a user