forked from Botanical/BotanJS
Various bug fixes & Preferred option for SiteFile
This commit is contained in:
parent
1b11a1dff0
commit
07ceb117da
@ -13,6 +13,8 @@
|
||||
/** @type {Components.MessageBox} */
|
||||
var MessageBox = __import( "Components.MessageBox" );
|
||||
|
||||
var compileProp = ns[ NS_INVOKE ]( "compileProp" );
|
||||
|
||||
var image = function( insertSnippet, snippetWrap, createContext, override )
|
||||
{
|
||||
var temp, i, j
|
||||
@ -25,12 +27,15 @@
|
||||
)
|
||||
, input_a = Dand.wrap(
|
||||
"input", null, "v_snippet_input_single", null, new IKey( "type", "text" )
|
||||
);
|
||||
)
|
||||
, input_preferred = Dand.wrapna('input', new IKey("type", "checkbox"))
|
||||
;
|
||||
|
||||
if (this._stage)
|
||||
{
|
||||
input_url.value = this._url;
|
||||
input_a.value = this._href;
|
||||
input_preferred.checked = (this._preferred == "on");
|
||||
}
|
||||
|
||||
// Popup MessageBox
|
||||
@ -41,27 +46,30 @@
|
||||
, input_url
|
||||
, Dand.wrapc( "v_instruction flsf", "Ancohr link(optional):" )
|
||||
, input_a
|
||||
, Dand.wrape([ input_preferred, Dand.textNode( "Preferred" ) ])
|
||||
]
|
||||
)
|
||||
, "OK", "Cancel"
|
||||
, visualizer.bind({ url:input_url, href:input_a, stage: this._stage })
|
||||
, visualizer.bind({ url:input_url, href:input_a, stage: this._stage, preferred: input_preferred })
|
||||
).show();
|
||||
}
|
||||
|
||||
, visualizer = function ( submitted, override )
|
||||
{
|
||||
var src, href
|
||||
var src, href, preferred
|
||||
, stage = this.stage;
|
||||
|
||||
if ( override )
|
||||
{
|
||||
src = override.value;
|
||||
href = override.href;
|
||||
preferred = override.preferred ? "on" : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
src = this.url.value;
|
||||
href = this.href.value;
|
||||
preferred = this.preferred.checked ? "on" : "";
|
||||
}
|
||||
|
||||
if ( submitted && src )
|
||||
@ -82,16 +90,17 @@
|
||||
Dand.wrapna(
|
||||
"img"
|
||||
, [
|
||||
new IKey("src", src)
|
||||
, new IKey("style", "max-width: 100%")
|
||||
new IKey( "src", src )
|
||||
, new IKey( "style", "max-width: 100%" )
|
||||
]
|
||||
)
|
||||
// caption
|
||||
, Dand.wrapc( "v_description", i )
|
||||
]
|
||||
, [
|
||||
new DataKey("value", src)
|
||||
, new DataKey("href", href)
|
||||
new DataKey( "value", src )
|
||||
, new DataKey( "href", href )
|
||||
, new DataKey( "preferred", preferred )
|
||||
]
|
||||
);
|
||||
insertSnippet( j = snippetWrap( "Image", temp ), Boolean( override ) );
|
||||
@ -102,6 +111,7 @@
|
||||
([
|
||||
new DataKey( "value", src )
|
||||
, new DataKey( "href", href )
|
||||
, new DataKey( "preferred", preferred )
|
||||
]);
|
||||
|
||||
stage.firstChild.setAttribute("src", src);
|
||||
@ -114,7 +124,12 @@
|
||||
temp = stage;
|
||||
}
|
||||
|
||||
i = { _url: src, _href: href, _stage: temp };
|
||||
i = {
|
||||
_url: src
|
||||
, _href: href
|
||||
, _preferred: preferred || "off"
|
||||
, _stage: temp
|
||||
};
|
||||
|
||||
// Set context menu
|
||||
createContext( i, j, handler );
|
||||
@ -138,10 +153,10 @@
|
||||
{
|
||||
// [img href=\"" + this.href.value + "\"]" + this.url.value + "[/img]
|
||||
var element = IDOMElement( stage )
|
||||
, href = element.getDAttribute( "href" );
|
||||
, props = [ "href", "preferred" ]
|
||||
|
||||
return "[img"
|
||||
+ ( href ? (" href=\"" + href + "\"") : "" )
|
||||
+ compileProp( element, props )
|
||||
+ "]"
|
||||
+ element.getDAttribute( "value" ) + "[/img]"
|
||||
;
|
||||
|
@ -19,8 +19,8 @@
|
||||
/** @type {Astro.utils.Date} */
|
||||
var XDate = __import( "Astro.utils.Date" );
|
||||
|
||||
|
||||
var escapeStr = ns[ NS_INVOKE ]( "escapeStr" );
|
||||
var compileProp = ns[ NS_INVOKE ]( "compileProp" );
|
||||
|
||||
var getData = __import( "System.Net.getData" );
|
||||
|
||||
@ -37,10 +37,27 @@
|
||||
, handler = function ()
|
||||
{
|
||||
// Input fields
|
||||
var v_snippetInput = Dand.wrap("input", null, "v_snippet_input_single", null, new IKey("type", "text"));
|
||||
var v_snippetInput = Dand.wrap("input", null, "v_snippet_input_single", null, new IKey("type", "text"))
|
||||
, input_preferred = Dand.wrapna('input', new IKey("type", "checkbox"))
|
||||
;
|
||||
|
||||
if ( this._stage )
|
||||
{
|
||||
v_snippetInput.value = this._content;
|
||||
input_preferred.checked = ( this._preferred == "on" );
|
||||
}
|
||||
|
||||
// Popup MessageBox
|
||||
new MessageBox("Insert site file", v_snippetInput, "OK", "Cancel", visualizer.bind({code: v_snippetInput})).show();
|
||||
new MessageBox("Insert site file"
|
||||
, Dand.wrape([
|
||||
v_snippetInput
|
||||
, Dand.wrape([ input_preferred, Dand.textNode( "Preferred" ) ])
|
||||
])
|
||||
, "OK", "Cancel", visualizer.bind({
|
||||
code: v_snippetInput
|
||||
, preferred: input_preferred
|
||||
, stage: this._stage
|
||||
})).show();
|
||||
}
|
||||
|
||||
, __applyData = function (e)
|
||||
@ -143,33 +160,66 @@
|
||||
, visualizer = function ( submitted, override )
|
||||
{
|
||||
|
||||
var hash = override ? override.value : this.code.value
|
||||
, _obj = {file: hash};
|
||||
var hash, _obj, stage = this.stage;
|
||||
|
||||
if( override )
|
||||
{
|
||||
hash = override.value;
|
||||
preferred = override.preferred ? "on" : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
hash = this.code.value;
|
||||
preferred = this.preferred.checked ? "on" : "";
|
||||
}
|
||||
|
||||
_obj = { file: hash };
|
||||
|
||||
if ( submitted && hash )
|
||||
{
|
||||
// Visualize component
|
||||
if (!stage)
|
||||
{
|
||||
temp = Dand.wrapc("v_box"
|
||||
, [
|
||||
Dand.wrape("Getting information from Server ...")
|
||||
, Dand.wrapc("v_description", "Site file (hash): " + hash)
|
||||
]
|
||||
, [
|
||||
new DataKey( "value", hash )
|
||||
, new DataKey( "size", ( override && override.size ) || "large" )
|
||||
, new IKey( "style", "max-height: 150px;" )
|
||||
, new DataKey( "preferred", preferred )
|
||||
]
|
||||
);
|
||||
|
||||
temp = Dand.wrapc("v_box"
|
||||
, [
|
||||
Dand.wrape("Getting information from Server ...")
|
||||
, Dand.wrapc("v_description", "Site file (hash): " + hash)
|
||||
]
|
||||
, [
|
||||
// Get data from site library
|
||||
getData( config.path.info + hash, __applyData.bind({stage: temp, hash: hash}), loadFailed );
|
||||
|
||||
insertSnippet(
|
||||
j = snippetWrap( "SiteFile", temp )
|
||||
, !!override
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
IDOMElement( stage ).setAttribute([
|
||||
new DataKey( "value", hash )
|
||||
, new DataKey( "size", ( override && override.size ) || "large" )
|
||||
, new IKey( "style", "max-height: 150px;" )
|
||||
]
|
||||
);
|
||||
, new DataKey( "preferred", preferred )
|
||||
]);
|
||||
getData( config.path.info + hash, __applyData.bind({stage: temp, hash: hash}), loadFailed );
|
||||
}
|
||||
|
||||
// Get data from site library
|
||||
getData( config.path.info + hash, __applyData.bind({stage: temp, hash: hash}), loadFailed );
|
||||
|
||||
insertSnippet(j = snippetWrap("SiteFile", temp), Boolean(override));
|
||||
|
||||
// Set context menu
|
||||
createContext(null, j);
|
||||
}
|
||||
|
||||
i = {
|
||||
_content: hash
|
||||
, _preferred: preferred || "off"
|
||||
, _stage: temp
|
||||
};
|
||||
|
||||
// Set context menu
|
||||
createContext( i, j, handler );
|
||||
};
|
||||
|
||||
if (override)
|
||||
@ -199,6 +249,10 @@
|
||||
{
|
||||
options += " size=\"" + opt + "\"";
|
||||
}
|
||||
if( opt = stage.getDAttribute( "preferred" ) )
|
||||
{
|
||||
options += " preferred=\"" + opt + "\"";
|
||||
}
|
||||
|
||||
return "[sitefile" + options + "]"
|
||||
+ escapeStr( stage.getDAttribute( "value" ) )
|
||||
|
@ -92,13 +92,11 @@
|
||||
else
|
||||
{
|
||||
IDOMElement(stage).setAttribute
|
||||
(
|
||||
[
|
||||
new DataKey("value", content)
|
||||
, new DataKey("title", title)
|
||||
, new DataKey("expanded", expanded)
|
||||
]
|
||||
);
|
||||
([
|
||||
new DataKey("value", content)
|
||||
, new DataKey("title", title)
|
||||
, new DataKey("expanded", expanded)
|
||||
]);
|
||||
|
||||
temp = stage.firstChild;
|
||||
temp.removeChild(temp.firstChild);
|
||||
|
@ -1,3 +1,7 @@
|
||||
.b_entry img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.b_entry {
|
||||
background-color: #FAFAFA;
|
||||
/* box-shadow: 0 0 8px -2px black; */
|
||||
|
@ -1,36 +1,35 @@
|
||||
.m_title {
|
||||
font-size: 2.5em;
|
||||
color: #444;
|
||||
.it-shucks > a {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.m_more {
|
||||
color: #76400C;
|
||||
}
|
||||
|
||||
.mega_entry span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mega_entry {
|
||||
.mega-entry {
|
||||
border: 6px solid white;
|
||||
background: white;
|
||||
color: black;
|
||||
|
||||
position: relative;
|
||||
margin: 1em;
|
||||
margin: 0.5em;
|
||||
|
||||
display: block;
|
||||
|
||||
word-wrap: break-word;
|
||||
|
||||
box-shadow: 0 0 0 1px #D4D7C9;
|
||||
|
||||
max-width: 80%;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.mega_entry:hover {
|
||||
.mega-entry:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.mega_entry:after {
|
||||
.mega-entry .cCont > img {
|
||||
position: absolute;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.mega-entry .cCont:after {
|
||||
content: attr(data-content);
|
||||
|
||||
width: 100%;
|
||||
@ -39,7 +38,6 @@
|
||||
top: 100%;
|
||||
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
|
||||
color: white;
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
@ -65,13 +63,13 @@
|
||||
transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); /* easeOutCubic */
|
||||
}
|
||||
|
||||
.mega_entry:focus:after, .mega_entry:hover:after {
|
||||
.mega-entry .cCont:focus:after, .mega-entry .cCont:hover:after {
|
||||
top: 50%;
|
||||
height: 50%;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
.mega_entry > #noteTag {
|
||||
.mega-entry > #noteTag {
|
||||
background: black;
|
||||
}
|
||||
|
||||
@ -90,35 +88,21 @@
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.mega_entry > .cCont {
|
||||
.mega-entry > .cCont {
|
||||
position: relative;
|
||||
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
height: 130px;
|
||||
background-position: center top;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #EEE;
|
||||
|
||||
background-image: url('http://file.astropenguin.net/blog/layout-images/archived.png');
|
||||
}
|
||||
|
||||
.mega_entry > .cCont:before {
|
||||
content: attr(data-content);
|
||||
position: absolute;
|
||||
.mega-entry .cCont > h2 {
|
||||
position: absolute;
|
||||
|
||||
line-height: 100%;
|
||||
font-size: 2.5em;
|
||||
|
||||
padding: 0.1em;
|
||||
|
||||
padding: 0 0.2em;
|
||||
text-shadow: 2px 2px 8px black;
|
||||
color: white;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
background-color: rgba( 0, 0, 0, 0.2 );
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.cDate {
|
||||
|
@ -15,9 +15,20 @@
|
||||
.section-buttons > a[data-name="blog"] {
|
||||
background-color: purple;
|
||||
}
|
||||
.section-buttons > a[data-name="wenku8"] {
|
||||
.section-buttons > a[data-name="works"] {
|
||||
background-color: royalblue;
|
||||
}
|
||||
.section-buttons > a[data-name="album"] {
|
||||
background-color: crimson;
|
||||
background-image:
|
||||
repeating-linear-gradient(
|
||||
45deg, transparent
|
||||
, transparent 2px, rgba(0,0,0,.2) 2px
|
||||
, rgba(0,0,0,.2) 3px, transparent 3px
|
||||
, transparent 5px, rgba(0,0,0,.2) 5px
|
||||
);
|
||||
}
|
||||
|
||||
.section-buttons > a > span {
|
||||
padding: 0.75em 0.5em;
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
.site_file {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
.sf_regular sup { vertical-align: baseline; }
|
||||
|
||||
.sf_regular {
|
||||
|
@ -1,6 +1,8 @@
|
||||
(function(){
|
||||
var ns = __namespace( "Astro.Blog.Components" );
|
||||
|
||||
/** @type {System.Debug} */
|
||||
var debug = __import( "System.Debug" );
|
||||
/** @type {System.utils.IKey} */
|
||||
var IKey = __import( "System.utils.IKey" );
|
||||
/** @type {Dandelion} */
|
||||
@ -23,6 +25,11 @@
|
||||
if( !config ) throw new Error( "config is not defined" );
|
||||
// TODO: Make a trigger for downloading from server
|
||||
var stage = Dand.id( id );
|
||||
if( !stage )
|
||||
{
|
||||
debug.Info( "[SiteFile] id not found: " + id );
|
||||
return;
|
||||
}
|
||||
this.id = id;
|
||||
this.hash = hash;
|
||||
this.type = IDOMElement( stage ).getDAttribute( "type" );
|
||||
|
@ -63,7 +63,7 @@ h6, .h6 { font-size: 0.5em; }
|
||||
}
|
||||
|
||||
.right { text-align: right; }
|
||||
.panel { padding: 1.2em; }
|
||||
.panel { padding: 0.5em 1.2em 1.2em 1.2em; }
|
||||
|
||||
/* transition properties */
|
||||
div#header, div#mbody, div#contact, div#horizon {
|
||||
|
Loading…
Reference in New Issue
Block a user