Skip to content

Commit

Permalink
Add editable
Browse files Browse the repository at this point in the history
  • Loading branch information
dafeng.xdf committed Sep 25, 2014
1 parent 40e9c3f commit 09e021c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ startserver
## Installment

```bash
$ npm install startserver -g
$ npm i startserver -g
```

## Quick Start
Expand Down
13 changes: 10 additions & 3 deletions lib/middleware/markdown/slide.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body {opacity: 0;color:#fff;font-family: "Verdana", "monaco", "Microsoft YaHei";
.current {opacity:1;z-index:999;}
.next {opacity:0.2;transform: translate(100%, 0);}
.inner {margin: 40px 100px;}
.inner a {text-decoration: none;color: #D1C556;}
.inner a {text-decoration: none;color: #D1C556;cursor:pointer;}
.inner h1 {font-size:50px;padding-bottom: 30px;}
.inner h2 {font-size:40px;padding-bottom: 20px;}
.inner h3 {font-size:30px;padding-bottom: 10px;}
Expand Down Expand Up @@ -101,7 +101,6 @@ allowtransparency="true" frameborder="0" scrolling="0" width="80px" height="20px
var right = document.getElementById("right");
var page = document.getElementById("page");
var isthumbnail = false;
page.contentEditable = "true";
page.designMode = "on";
var pages = page.children;
var radios = document.getElementById("radios");
Expand Down Expand Up @@ -150,11 +149,15 @@ allowtransparency="true" frameborder="0" scrolling="0" width="80px" height="20px
}
function thumbnail() {
page.contentEditable = isthumbnail ? "true" : "false";
editAble(isthumbnail ? "false" : "true");
document.body.className = isthumbnail ? "" : "thumbnail";
isthumbnail = !isthumbnail;
}
function editAble(r) {
page.contentEditable = r;
}
function slider() {
if (index == 0) return thumbnail();
removeClass();
Expand Down Expand Up @@ -227,6 +230,10 @@ allowtransparency="true" frameborder="0" scrolling="0" width="80px" height="20px
right.addEventListener("click", function() {
next();
});
page.addEventListener("dblclick", function() {
if (isthumbnail) return;
editAble(page.contentEditable === "true" ? "false" : "true");
});
document.addEventListener("keydown", function(e) {
switch (e.keyCode) {
case 39:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "startserver",
"version": "0.5.6",
"version": "0.5.8",
"description": "A simple http server witch can be used like `python -m SimpleHTTPServer` and be more easy to generate a slider.",
"preferGlobal": true,
"bin": {
Expand Down

0 comments on commit 09e021c

Please sign in to comment.