@ -1,9 +1,33 @@
var MAX _DESC _NUM = 5 ; // 最多显示5条信息
function i18nText ( key ) {
function i18nText ( key ) {
return Pool . data . i18nText ( key ) ;
return Pool . data . i18nText ( key ) ;
}
}
window . addEventListener ( "load" , function ( ev ) {
function getDescArea ( descList ) {
var title = BI . createWidget ( {
var descItems = [ ] ;
for ( var i in descList ) {
var num = parseInt ( i ) + 1 ;
if ( num > MAX _DESC _NUM ) {
break ;
}
descItems . push ( {
type : "bi.label" ,
text : num + ")" + descList [ i ] ,
whiteSpace : "pre-wrap" ,
textAlign : "left"
} )
}
return BI . createWidget ( {
type : "bi.vertical" ,
cls : "desc" ,
items : descItems
} ) ;
}
function getTitleArea ( ) {
return BI . createWidget ( {
type : "bi.vertical" ,
type : "bi.vertical" ,
items : [
items : [
{
{
@ -15,31 +39,15 @@ window.addEventListener("load", function (ev) {
{
{
type : "bi.label" ,
type : "bi.label" ,
text : Pool . data . getVersion ( ) ,
text : Pool . data . getVersion ( ) ,
cls : "version" ,
textAlign : "left"
textAlign : "left"
}
}
]
]
} ) ;
} ) ;
}
var desc = BI . createWidget ( {
function getButtonGroup ( ) {
type : "bi.vertical" ,
return BI . createWidget ( {
cls : "desc" ,
items : [
{
type : "bi.label" ,
text : Pool . data . getContent ( ) ,
textAlign : "left"
}
]
} ) ;
var moreInfo = BI . createWidget ( {
type : "bi.text_button" ,
text : i18nText ( "Fine-Design_Basic_More_Information" ) ,
cls : "moreInfo" ,
textAlign : "left"
} ) ;
var buttonGroup = BI . createWidget ( {
type : 'bi.left' ,
type : 'bi.left' ,
cls : "buttonGroup" ,
cls : "buttonGroup" ,
items : [
items : [
@ -47,8 +55,8 @@ window.addEventListener("load", function (ev) {
type : 'bi.button' ,
type : 'bi.button' ,
text : i18nText ( "Fine-Design_Update_Now" ) ,
text : i18nText ( "Fine-Design_Update_Now" ) ,
level : 'common' ,
level : 'common' ,
height : 30 ,
height : 24 ,
handler : function ( ) {
handler : function ( ) {
Pool . data . updateNow ( ) ;
Pool . data . updateNow ( ) ;
}
}
} ,
} ,
@ -57,8 +65,8 @@ window.addEventListener("load", function (ev) {
type : 'bi.button' ,
type : 'bi.button' ,
text : i18nText ( "Fine-Design_Remind_Me_Next_Time" ) ,
text : i18nText ( "Fine-Design_Remind_Me_Next_Time" ) ,
level : 'ignore' ,
level : 'ignore' ,
height : 30 ,
height : 24 ,
handler : function ( ) {
handler : function ( ) {
Pool . data . remindNextTime ( ) ;
Pool . data . remindNextTime ( ) ;
}
}
} ,
} ,
@ -69,8 +77,8 @@ window.addEventListener("load", function (ev) {
type : 'bi.button' ,
type : 'bi.button' ,
text : i18nText ( "Fine-Design_Skip_This_Version" ) ,
text : i18nText ( "Fine-Design_Skip_This_Version" ) ,
level : 'ignore' ,
level : 'ignore' ,
height : 30 ,
height : 24 ,
handler : function ( ) {
handler : function ( ) {
Pool . data . skipThisVersion ( ) ;
Pool . data . skipThisVersion ( ) ;
}
}
} ,
} ,
@ -78,17 +86,48 @@ window.addEventListener("load", function (ev) {
}
}
]
]
} ) ;
} ) ;
}
function getMoreInfo ( ) {
return BI . createWidget ( {
type : "bi.text_button" ,
text : i18nText ( "Fine-Design_See_More_New_Features" ) ,
cls : "moreInfo" ,
textAlign : "left" ,
handler : function ( ) {
// 为了使用系统的浏览器,只能从 Java 那边打开网页
Pool . data . browseMoreInfoUrl ( ) ;
}
} ) ;
}
function getShowItems ( ) {
var title = getTitleArea ( ) ;
var descList = Pool . data . getContent ( ) . split ( "\n" ) ;
var descArea = getDescArea ( descList ) ;
var moreInfo = getMoreInfo ( ) ;
var buttonGroup = getButtonGroup ( ) ;
var showItems = [ title , descArea ] ;
if ( descList . length > MAX _DESC _NUM ) {
showItems . push ( moreInfo ) ;
}
showItems . push ( buttonGroup ) ;
return showItems ;
}
window . addEventListener ( "load" , function ( ev ) {
var showItems = getShowItems ( ) ;
var container = BI . createWidget ( {
var container = BI . createWidget ( {
type : "bi.vertical" ,
type : "bi.vertical" ,
element : "body" ,
element : "body" ,
cls : "container" ,
cls : "container" ,
items : [
items : showItems
title ,
desc ,
moreInfo ,
buttonGroup
]
} ) ;
} ) ;
container . element . css ( "background" , "url(" + Pool . data . getBackgroundUrl ( ) + ")" ) ;
container . element . css ( "background" , "url(" + Pool . data . getBackgroundUrl ( ) + ")" ) ;