Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

bug fixed itself

  • Loading branch information
DIYgod committed May 13, 2015
1 parent bccdefc commit df0e0bf051852bb1e4593c6dae3ff11cfa9c34ce
Showing with 27 additions and 11 deletions.
  1. +3 −4 task0003/css/style.css
  2. +24 −7 task0003/js/gtd.js
@@ -18,7 +18,6 @@ li {
}

body {
min-width: 980px;
overflow: hidden;
}

@@ -86,8 +85,8 @@ h6,

.type-wrap {
height: 100%;
overflow: scroll;
opacity: 0.87;
overflow: scroll;
}

.type-wrap h2 {
@@ -241,8 +240,8 @@ h6,
left: 470px;
box-shadow: 1px 1px 3px #9e9e9e;
border-radius: 5px;
overflow: scroll;
z-index: 1;
overflow: scroll;
}

.task-info {
@@ -373,7 +372,7 @@ h6,

.myButton {
float: right;
width: 70px;
width: 80px;
height: 28px;
background-color: #2196f3;
border-radius: 6px;
@@ -101,6 +101,8 @@ function makeType() {
html = html.replace(/<i class="delete icon-minus-circled"><\/i>/, ''); // 去掉默认分类的删除按钮
$('.item-wrap').innerHTML = html;

$('h2').onclick(); // 默认选择第一个分类

makeTask();
}

@@ -310,14 +312,13 @@ function typeAdd() {
+ '<p>'
+ '新分类父节点:'
+ '<select class="mySelect">'
+ '<option value="0">无</option>'
+ '<option value="-1">无</option>'

var itemWrap = document.getElementsByClassName('item-wrap')[0];
var itemName = itemWrap.getElementsByTagName('h3');
for (var i = 0; i < itemName.length; i++) {
console.log(itemName[i].getElementsByTagName('span'));
html += ''
+ '<option value="'+ (i + 1) +'">' + itemName[i].getElementsByTagName('span')[0].innerHTML + '</option>'
+ '<option value="'+ i +'">' + itemName[i].getElementsByTagName('span')[0].innerHTML + '</option>'
}

html += ''
@@ -337,7 +338,7 @@ function taskAdd() {
var html = ''
+ '<p>'
+ '新任务名称:'
+ '<input type="text" class="myText" placeholder="在此输入新分类的名称">'
+ '<input type="text" class="myText" placeholder="在此输入新任务的名称">'
+ '</p>'
+ '<button class="myButton" onclick="closePop()">取消</button>'
+ '<button class="myButton" onclick="newTask()">确定</button>'
@@ -352,7 +353,23 @@ function closePop() {

// 新建分类
function newType() {
var name = $('.myText').value;
var fatherName = $('.mySelect').value;
if (fatherName === '-1') { // 添加分类
var newCate = {
"id": cate[cate.length - 1].id + 1,
"name": name,
"num": 0,
"child": []
};
cate.push(newCate);
//cate.stringify
}
else { // 添加子分类

}
makeType();
closePop();
}

// 新建任务
@@ -367,8 +384,8 @@ window.onload = function () {
localStorage.task = taskText;
document.getElementById('type-all').className = 'choose';
// }
cate = eval ('(' + localStorage.cate + ')');
childCate = eval ('(' + localStorage.childCate + ')');
task = eval ('(' + localStorage.task + ')');
cate = eval('(' + localStorage.cate + ')');
childCate = eval('(' + localStorage.childCate + ')');
task = eval('(' + localStorage.task + ')');
makeType();
}

0 comments on commit df0e0bf

Please sign in to comment.
You can’t perform that action at this time.