Commit 3db8de24 authored by Lingnan Wu's avatar Lingnan Wu

change the style of index.html ,seperate the js function , add a listnumber for the list object

parent e772613d
This diff is collapsed.
//automatically build the list
NewList = function (listnumber,listname,listcontent){
var listNumber=listnumber;
//get the main list
var mainList = document.getElementById("textlist");
//set the new element
newElement = document.createElement("li");
newElement.setAttribute("class","ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c");
newElement.setAttribute("data-theme","c");
newElement.setAttribute("data-iconpos","right");
newElement.setAttribute("data-icon","arrow-r");
newElement.setAttribute("data-wrapperels","div");
newElement.setAttribute("data-iconshadow","true");
newElement.setAttribute("data-shadow","false");
newElement.setAttribute("data-corners","false");
mainList.appendChild(newElement);
//set firstdiv
newFirstdiv = document.createElement("div");
newFirstdiv.setAttribute("class","ui-btn-inner ui-li");
newElement.appendChild(newFirstdiv);
//set seconddiv
newSeconddiv = document.createElement("div");
newSeconddiv.setAttribute("class","ui-btn-text");
newFirstdiv.appendChild(newSeconddiv);
//set a tag
newa = document.createElement("a");
newa.setAttribute("class","ui-link-inherit");
newa.setAttribute("href","#text");
//set the listnumber to control
newa.setAttribute("value",listNumber);
newa.setAttribute("onclick","setTextEditorInformation(OfficeJS.list[i].title,OfficeJS.list[i].title,OfficeJS.list[i].title,OfficeJS.list[i].text);");
newSeconddiv.appendChild(newa);
//set head
newhead = document.createElement("h3");
newhead.setAttribute("class","ui-li-heading");
newa.appendChild(newhead);
newHeadtext = document.createTextNode(listname);
newhead.appendChild(newHeadtext);
//set content
newcontent = document.createElement("p");
newcontent.setAttribute("class","ui-li-desc");
newa.appendChild(newcontent);
newContenttext = document.createTextNode(listcontent);
newcontent.appendChild(newContenttext);
//set shadow
newshadow = document.createElement("span");
newshadow.setAttribute("class","ui-icon ui-icon-arrow-r ui-icon-shadow");
newFirstdiv.appendChild(newshadow);
}
function CreateLists(){
//clean all the lists
var n = document.getElementById('textlist').childNodes.length;
for ( var i = 0; i < n; i++) {
document.getElementById('textlist').removeChild(
document.getElementById('textlist').firstChild);
}
//set the new lists
for(i=0;i<OfficeJS.list.length;i++){
NewList(i,OfficeJS.list[i].title,OfficeJS.list[i].text);
}
}
......@@ -19,7 +19,7 @@
var that = {}, priv = {};
// Attributes //
that.list=new Array();//数组
that.list=new Array();//List for ListPage
priv.preference_object = {
......@@ -513,15 +513,11 @@ that.list=new Array();//数组
that.getList();
}
});*/
var obj=new Object();//new object
obj.title=basename;//object title and text
obj.text=content;
that.list.push(obj);//save in the list
var newlist=new Object();//new object
newlist.title=basename;//object title and text
newlist.text=content;
newlist.number=that.list.length;
that.list.push(obj);//save in the list
};
/**
......
//set the text Editor
function setTextEditorInformation(name,content){
var nameTextarea = document.getElementById("input_file_name");
nameTextarea.value=name;
var contentTextarea = document.getElementById("input_file_content");
contentTextarea.value=content;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment