ArticleContent should display article title

This commit is contained in:
斟酌 鵬兄 2016-05-25 12:13:24 +08:00
parent 1d17093c45
commit 5d2029dd54
5 changed files with 42 additions and 10 deletions

View File

@ -178,12 +178,12 @@
{ {
if( incoming ) if( incoming )
{ {
IDOMElement( Dand.wrap() ).lootChildren( __stage[1] ); IDOMElement( __stage[1] ).clear();
var ThisCands = ModLevels.Cands().Get(); var ThisCands = ModLevels.Cands().Get();
if( ThisCands.length ) if( ThisCands.length )
{ {
IDOMElement( __stage[1] ).lootChildren( Dand.wrape( ThisCands ) ); IDOMElement( __stage[1] ).loot( Dand.wrape( ThisCands ) );
} }
} }

View File

@ -0,0 +1,7 @@
.v_boundary[data-type="ArticleContent"] {
color: #999;
}
.v_boundary[data-type="ArticleContent"] span.info {
color: #f15a24;
}

View File

@ -23,6 +23,8 @@
var unescapeStr = ns[ NS_INVOKE ]( "unescapeStr" ); var unescapeStr = ns[ NS_INVOKE ]( "unescapeStr" );
var compileProp = ns[ NS_INVOKE ]( "compileProp" ); var compileProp = ns[ NS_INVOKE ]( "compileProp" );
var postData = __import( "System.Net.postData" );
/** @type {_AstConf_.AstroEdit} */ /** @type {_AstConf_.AstroEdit} */
var config = null; var config = null;
@ -72,26 +74,33 @@
id = this.id.value; id = this.id.value;
} }
var ACInfo = [ "ArticleContent[ ", Dand.wrap( "span", null, "info", id ), " ]" ];
if ( submitted && id ) if ( submitted && id )
{ {
// Visualize component // Visualize component
if (!stage) if (!stage)
{ {
temp = Dand.wrapne( "span" temp = Dand.wrapne( "span"
, "ArticleContent[" + id + "]" , ACInfo
, new DataKey( "value", id ) , new DataKey( "value", id )
); );
insertSnippet( insertSnippet(
j = snippetWrap( "ArticleContent", temp, false, "span" ) j = snippetWrap(
"ArticleContent"
, temp
, false, "span"
)
, !!override , !!override
); );
} }
else else
{ {
stage.firstChild.textContent = "ArticleContent[" + id + "]"; var stg = IDOMElement( stage );
IDOMElement( stage ).setAttribute( new DataKey( "value", id ) ); stg.clear();
stg.loot( Dand.wrape( ACInfo ) );
stg.setAttribute( new DataKey( "value", id ) );
} }
i = { i = {
@ -99,6 +108,22 @@
, _stage: temp , _stage: temp
}; };
// Get title of this article
postData(
config.paths.get_article
, { article_id: id }
/** @param {_AstJson_.AJaxGetArticle} */
, function( e )
{
ACInfo[1].firstChild.textContent = e.entry.title;
}
, function()
{
ACInfo[1].firstChild.textContent = "ERROR";
} );
// Set context menu // Set context menu
createContext( i, j, handler ); createContext( i, j, handler );
} }

View File

@ -272,8 +272,8 @@
// innerText does not work in firefox:( // innerText does not work in firefox:(
temp = Dand.wrape( raw.substr( lastOffset, offset - lastOffset ) ); temp = Dand.wrape( raw.substr( lastOffset, offset - lastOffset ) );
// innerHTML will escape html entities, now replace linebreaks to br // innerHTML will escape html entities, now replace linebreaks to br
temp.innerHTML = temp.innerHTML.replace(/[\r\n]/g, "<br>"); temp.innerHTML = temp.innerHTML.replace( /[\r\n]/g, "<br>" );
IDOMElement( contentDiv ).lootChildren( temp ); IDOMElement( contentDiv ).loot( temp );
} }
lastOffset = offset + match.length; lastOffset = offset + match.length;
@ -477,7 +477,7 @@
temp = Dand.wrape( raw.substr( lastOffset, raw.length - lastOffset ) ); temp = Dand.wrape( raw.substr( lastOffset, raw.length - lastOffset ) );
// innerHTML will escape html entities, now replace linebreaks to br // innerHTML will escape html entities, now replace linebreaks to br
temp.innerHTML = temp.innerHTML.replace( /[\r\n]/g, "<br>" ); temp.innerHTML = temp.innerHTML.replace( /[\r\n]/g, "<br>" );
IDOMElement( contentDiv ).lootChildren( temp ); IDOMElement( contentDiv ).loot( temp );
} }
temp = null; temp = null;
raw = null; raw = null;

View File

@ -515,7 +515,7 @@
: function () : function ()
{ {
// Remove capcha // Remove capcha
new IDOMElement().lootChildren( Dand.id( "recaptcha_field" ) ); Dand.id( "recaptcha_field", true ).clear();
try try
{ {
Recaptcha.render( "recaptcha_field", { Recaptcha.render( "recaptcha_field", {