From 0c9da59537e8f7a49e499f67e20fed9f277ddaac Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Wed, 27 Jan 2016 11:10:33 -0800 Subject: [PATCH] no work --- pub/work/hymn.hook | 34 - pub/work/src/css/fonts.styl | 84 - pub/work/src/css/main.css | 503 ---- pub/work/src/css/main.styl | 352 --- pub/work/src/css/mobile.styl | 86 - pub/work/src/js/actions/WorkActions.coffee | 78 - .../src/js/components/FieldComponent.coffee | 95 - .../src/js/components/FilterComponent.coffee | 60 - .../src/js/components/ItemComponent.coffee | 162 -- .../src/js/components/ListComponent.coffee | 175 -- .../js/components/ListeningComponent.coffee | 7 - .../src/js/components/SortComponent.coffee | 27 - .../src/js/components/WorkComponent.coffee | 12 - pub/work/src/js/dispatcher/dispatcher.coffee | 13 - pub/work/src/js/main.coffee | 5 - pub/work/src/js/main.js | 2161 ----------------- pub/work/src/js/package.json | 17 - .../src/js/persistence/Persistence.coffee | 21 - pub/work/src/js/stores/WorkStore.coffee | 153 -- pub/work/src/js/util.coffee | 38 - pub/work/test.work-task | 8 - 21 files changed, 4091 deletions(-) delete mode 100644 pub/work/hymn.hook delete mode 100644 pub/work/src/css/fonts.styl delete mode 100644 pub/work/src/css/main.css delete mode 100644 pub/work/src/css/main.styl delete mode 100644 pub/work/src/css/mobile.styl delete mode 100644 pub/work/src/js/actions/WorkActions.coffee delete mode 100644 pub/work/src/js/components/FieldComponent.coffee delete mode 100644 pub/work/src/js/components/FilterComponent.coffee delete mode 100644 pub/work/src/js/components/ItemComponent.coffee delete mode 100644 pub/work/src/js/components/ListComponent.coffee delete mode 100644 pub/work/src/js/components/ListeningComponent.coffee delete mode 100644 pub/work/src/js/components/SortComponent.coffee delete mode 100644 pub/work/src/js/components/WorkComponent.coffee delete mode 100644 pub/work/src/js/dispatcher/dispatcher.coffee delete mode 100644 pub/work/src/js/main.coffee delete mode 100644 pub/work/src/js/main.js delete mode 100644 pub/work/src/js/package.json delete mode 100644 pub/work/src/js/persistence/Persistence.coffee delete mode 100644 pub/work/src/js/stores/WorkStore.coffee delete mode 100644 pub/work/src/js/util.coffee delete mode 100644 pub/work/test.work-task diff --git a/pub/work/hymn.hook b/pub/work/hymn.hook deleted file mode 100644 index c859e8f857..0000000000 --- a/pub/work/hymn.hook +++ /dev/null @@ -1,34 +0,0 @@ -:: -:: -:::: /hook/hymn/fab/talk/pub/ - :: -|% -++ cdnj - |= a=wall ^- marl - %+ turn a - |= lib=tape - ;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/{lib}"); --- -:: -:::: - :: -^- manx -;html - ;head - ;meta(charset "utf-8"); - ;* %- cdnj :~ - "jquery/2.1.1/jquery.js" - "lodash.js/2.4.1/lodash.min.js" - "react/0.13.1/react.js" - == - ;script(type "text/javascript", src "/~/as/own/~/at/home/lib/urb.js"); - ;meta(name "viewport", content "width=device-width, height=device-height, ". - "initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"); - ;link(type "text/css", rel "stylesheet", href "/home/pub/work/src/css/main.css"); - ;title: Work - == - ;body - ;div#c; - ;script(type "text/javascript", src "/home/pub/work/src/js/main.js"); - == -== diff --git a/pub/work/src/css/fonts.styl b/pub/work/src/css/fonts.styl deleted file mode 100644 index 1e64aa3860..0000000000 --- a/pub/work/src/css/fonts.styl +++ /dev/null @@ -1,84 +0,0 @@ -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau.woff"); - font-weight: 400; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-italic.woff"); - font-weight: 400; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-medium.woff"); - font-weight: 500; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-mediumitalic.woff"); - font-weight: 500; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-bold.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-bolditalic.woff"); - font-weight: 600; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-super.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-superitalic.woff"); - font-weight: 600; - font-style: italic; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-extralight.woff"); - font-weight: 200; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-light.woff"); - font-weight: 300; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-regular.woff"); - font-weight: 400; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-medium.woff"); - font-weight: 500; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-bold.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-black.woff"); - font-weight: 700; - font-style: normal; -} \ No newline at end of file diff --git a/pub/work/src/css/main.css b/pub/work/src/css/main.css deleted file mode 100644 index 4d6fb0cf7e..0000000000 --- a/pub/work/src/css/main.css +++ /dev/null @@ -1,503 +0,0 @@ -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau.woff"); - font-weight: 400; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-italic.woff"); - font-weight: 400; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-medium.woff"); - font-weight: 500; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-mediumitalic.woff"); - font-weight: 500; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-bold.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-bolditalic.woff"); - font-weight: 600; - font-style: italic; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-super.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "bau"; - src: url("http://storage.googleapis.com/urbit-extra/bau-superitalic.woff"); - font-weight: 600; - font-style: italic; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-extralight.woff"); - font-weight: 200; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-light.woff"); - font-weight: 300; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-regular.woff"); - font-weight: 400; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-medium.woff"); - font-weight: 500; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-bold.woff"); - font-weight: 600; - font-style: normal; -} -@font-face { - font-family: "scp"; - src: url("http://storage.googleapis.com/urbit-extra/scp-black.woff"); - font-weight: 700; - font-style: normal; -} -html, -body, -input, -label, -button { - font-family: "bau"; - font-size: 18px; -} -#c { - position: absolute; - top: 0rem; - left: 50%; - width: 34rem; - margin-left: -17rem; - margin-bottom: 12rem; -} -h1 { - font-weight: 500; -} -input, -button, -.input { - outline: none; - border: 0; -} -h1.leader:after { - content: "—"; - margin-left: 0.6rem; -} -.ctrl .sort label, -.ctrl .filter label { - text-transform: capitalize; - font-size: 1rem; - letter-spacing: 0.07rem; -} -.item .status { - text-transform: uppercase; - font-size: 0.7rem; - letter-spacing: 0.07rem; -} -.ctrl { - margin-top: 2rem; -} -.ctrl h1 { - font-size: 1rem; -} -.ctrl .sorts, -.ctrl .filters { - margin-left: -0.3rem; -} -.ctrl .sorts { - margin-top: 1rem; -} -.ctrl .sort, -.ctrl .filter label { - font-weight: 500; -} -.ctrl .filter { - line-height: 2rem; - margin-right: 1rem; - vertical-align: middle; -} -.ctrl .sort { - border: 0; - cursor: pointer; - background-color: #000; - color: #fff; - margin-right: 1rem; -} -.ctrl .filter label { - margin-right: 0.3rem; -} -.ctrl .sort label, -.ctrl .filter label { - line-height: 2rem; -} -.ctrl .sort.s-1 label, -.ctrl .sort.s--1 label { - margin-right: 0.3rem; - cursor: pointer; -} -.input-bool { - opacity: 0.3; -} -.input-bool.true, -.input-bool.false { - opacity: 1; -} -.input-bool, -.item .done { - width: 1rem; - height: 1rem; - border: 0.2rem solid #ccc; - padding: 0; - outline: none; - background-color: #fff; -} -.input-bool.true, -.item .done-true { - background-color: #ccc; -} -.items { - margin-top: 2rem; - margin-left: -2rem; -} -.item { - display: block; - min-height: 3rem; - max-height: 3rem; - margin-bottom: 1.5rem; - width: 36rem; - overflow: hidden; - background-color: #fff; - transition: max-height 200ms linear; -} -.item .description, -.item .discussion { - transition: visibility 0s linear 200ms; - visibility: hidden; -} -.item.expand { - max-height: 24rem; - transition: max-height 200ms linear; -} -.item.expand .description, -.item.expand .discussion { - transition: visibility 0s; - visibility: visible; -} -.item .expand { - margin-left: 2rem; - cursor: pointer; - transform-origin: 6px 12px; - transition: transform 200ms linear; - -webkit-transform-origin: 6px 12px; -} -.item.expand .expand { - transform: rotate(90deg); - -webkit-transform: rotate(90deg); - transition: transform 200ms linear; -} -.item .header { - display: block; - width: 100%; - height: 1rem; - overflow: hidden; - white-space: nowrap; -} -.item .sort, -.item .title, -.item .date, -.item .tags, -.item .comment { - line-height: 2rem; -} -.item .sort, -.item .date { - font-family: 'scp'; -} -.item .creator, -.item .audience, -.item .date, -.item .ship { - font-size: 0.7rem; -} -.item .sort { - opacity: 0; - width: 1rem; - height: 0.2rem; - background-color: #e0e0e0; - border-top: 0.2rem solid #ccc; - border-bottom: 0.2rem solid #ccc; - margin: 0 0.5rem; - margin-top: -0.6rem; -} -.item:hover .sort { - opacity: 1; -} -.item .done { - margin-top: 0.5rem; -} -.item .creator, -.item .audience, -.item .date, -.item .ship { - text-transform: uppercase; - height: 1rem; - letter-spacing: 0.07rem; -} -.item .creator { - max-width: 7rem; - margin: 0 1rem 0 2rem; -} -.item .label { - font-style: italic; - color: #555; -} -.item:hover .action-true .label, -.item .action { - display: none; -} -.item:hover .action-true .action { - display: inline-block; -} -.item .audience { - margin-left: 2.2rem; - width: 24rem; -} -.item .audience .input { - background-color: transparent; -} -.item .title, -.item .date, -.item .tags { - overflow: hidden; - white-space: nowrap; - height: 2rem; -} -.item .title { - width: 16rem; - margin-left: 0.5rem; -} -.item .date, -.item .tags { - max-width: 6rem; - min-width: 6rem; -} -.item .description, -.item .discussion { - line-height: 2rem; - margin: 0.5rem 0 0.5rem 2rem; -} -.item .discussion { - max-height: 9rem; - overflow-x: hidden; - overflow-y: scroll; -} -.item .description textarea { - min-width: 32rem; - min-height: 6rem; -} -.item .comp { - width: 3rem; - opacity: 0; -} -.item .comp .a { - display: block; - font-size: 0.7rem; - font-weight: 500; - line-height: 0.9rem; -} -.item:hover .comp { - opacity: 1; -} -.item .submit { - font-size: 0.7rem; - font-weight: 500; - display: inline-block; - background-color: #b9b9b9; - letter-spacing: 0.07rem; - color: #fff; - border: 0; - padding: 0.6rem 0.3rem; - margin-top: 0.5rem; -} -.comment { - margin-bottom: 1rem; -} -.comment .date, -.comment .ship { - max-width: 12rem; - margin-right: 1rem; -} -.comment .body { - margin-top: 1rem; -} -.comment.new .input { - max-width: 31rem; - margin-top: 1rem; -} -/* global */ -.top { - vertical-align: top; -} -.ib { - display: inline-block; -} -.hidden { - display: none; -} -.a { - display: inline; - cursor: pointer; - text-decoration: underline; -} -.input { - padding: 0 0.6rem 0 0.3rem; - background-color: #ececec; - border: 0; - font: inherit; - resize: none; - -webkit-user-select: text; - user-select: text; -} -textarea:focus, -.input:focus { - background-color: #e6e6e6; -} -.invalid .input { - color: #f00; -} -.caret.left { - border-left: 12px solid #000; - border-top: 9px solid transparent; - border-right: 9px solid transparent; - border-bottom: 9px solid transparent; - margin-top: 0.4rem; -} -.s-1 .caret, -.caret.down { - border-left: 6px solid transparent; - border-top: 6px solid #fff; - border-right: 6px solid transparent; - border-bottom: 6px solid transparent; -} -.s--1 .caret, -.caret.up { - border-left: 6px solid transparent; - border-top: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; -} -.hr1 { - height: 0.2rem; - width: 6rem; - background-color: #ccc; - margin-left: 2.2rem; -} -.hr2 { - height: 0.1rem; - width: 3rem; - background-color: #ccc; -} -@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { - #c { - width: 100%; - margin: 0; - left: 0.6rem; - } - h1 { - font-size: 1rem; - } - input, - textarea { - -webkit-appearance: none; - border-radius: 0; - } - .input { - padding: 0 0.3rem 0 0.1rem; - } - .ctrl { - margin-top: 1rem; - } - .ctrl .sorts, - .ctrl .filters { - margin-left: 0; - } - .ctrl .filters .done label { - display: none; - } - .ctrl .sort { - padding: 0.2rem 0.3rem; - } - .ctrl .filter { - line-height: 1.3rem; - } - .ctrl .sort label, - .ctrl .filter label { - font-size: 0.7rem; - letter-spacing: 0.05rem; - line-height: 1.3rem; - } - .items { - margin-left: 0; - } - .item { - width: auto; - } - .item .sort { - display: none; - } - .item .title, - .item .date, - .item .tags { - min-width: 4rem; - max-width: 6rem; - overflow: hidden; - margin-left: 0.3rem; - } - .item .expand { - float: right; - margin-right: 0.6rem; - } - .item .description, - .item .discussion { - margin: 0.5rem 0; - } - .item .description textarea { - min-width: 18rem; - margin: 0; - } - .item .comment.new { - max-width: 18rem; - } - .item .submit { - line-height: 1.6rem; - letter-spacing: 0; - } -} diff --git a/pub/work/src/css/main.styl b/pub/work/src/css/main.styl deleted file mode 100644 index c6554c5c00..0000000000 --- a/pub/work/src/css/main.styl +++ /dev/null @@ -1,352 +0,0 @@ -// -// fonts first -// - -@import 'fonts' - -html -body -input -label -button - font-family "bau" - font-size 18px - -#c - position absolute - top 0rem - left 50% - width 34rem - margin-left -17rem - margin-bottom 12rem - -h1 - font-weight 500 - -input -button -.input - outline none - border 0 - -h1.leader:after - content "—" - margin-left .6rem - -.ctrl .sort label -.ctrl .filter label - text-transform capitalize - font-size 1rem - letter-spacing .07rem - -.item .status - text-transform uppercase - font-size .7rem - letter-spacing .07rem - -.ctrl - margin-top 2rem - - h1 - font-size 1rem - - .sorts - .filters - margin-left -.3rem - - .sorts - margin-top 1rem - - .sort - .filter label - font-weight 500 - - .filter - line-height 2rem - margin-right 1rem - vertical-align middle - - .sort - border 0 - cursor pointer - background-color #000 - color #fff - margin-right 1rem - - .filter label - margin-right .3rem - - .sort label - .filter label - line-height 2rem - - .sort.s-1 - .sort.s--1 - label - margin-right .3rem - cursor pointer - -.input-bool - opacity .3 - -.input-bool.true -.input-bool.false - opacity 1 - - -.input-bool -.item .done - width 1rem - height 1rem - border .2rem solid #ccc - padding 0 - outline none - background-color #fff - -.input-bool.true -.item .done-true - background-color #ccc - -.items - margin-top 2rem - margin-left -2rem - -.item - display block - min-height 3rem - max-height 3rem - margin-bottom 1.5rem - width 36rem - overflow hidden - background-color #fff - transition max-height 200ms linear - - .description - .discussion - transition visibility 0s linear 200ms - visibility hidden - - &.expand - max-height 24rem - transition max-height 200ms linear - - .description - .discussion - transition visibility 0s - visibility visible - - .expand - margin-left 2rem - cursor pointer - transform-origin 6px 12px - transition transform 200ms linear - -webkit-transform-origin 6px 12px - - &.expand .expand - transform rotate(90deg) - -webkit-transform rotate(90deg) - transition transform 200ms linear - - .header - display block - width 100% - height 1rem - overflow hidden - white-space nowrap - - .sort - .title - .date - .tags - .comment - line-height 2rem - - .sort - .date - font-family 'scp' - - .creator - .audience - .date - .ship - font-size .7rem - - .sort - opacity 0 - width 1rem - height .2rem - background-color #e0e0e0 - border-top .2rem solid #ccc - border-bottom .2rem solid #ccc - margin 0 .5rem - margin-top -.6rem - - &:hover .sort - opacity 1 - - .done - margin-top .5rem - - .creator - .audience - .date - .ship - text-transform uppercase - height 1rem - letter-spacing .07rem - - .creator - max-width 7rem - margin 0 1rem 0 2rem - - .label - font-style italic - color #555 - - &:hover .action-true .label - .action - display none - - &:hover .action-true .action - display inline-block - - .audience - margin-left 2.2rem - width 24rem - - .audience .input - background-color transparent - - .title - .date - .tags - overflow hidden - white-space nowrap - height 2rem - - .title - width 16rem - margin-left .5rem - - .date - .tags - max-width 6rem - min-width 6rem - - .description - .discussion - line-height 2rem - margin .5rem 0 .5rem 2rem - - .discussion - max-height 9rem - overflow-x hidden - overflow-y scroll - - .description textarea - min-width 32rem - min-height 6rem - - .comp - width 3rem - opacity 0 - .a - display block - font-size .7rem - font-weight 500 - line-height .9rem - - &:hover .comp - opacity 1 - - .submit - font-size .7rem - font-weight 500 - display inline-block - background-color #b9b9b9 - letter-spacing .07rem - color #fff - border 0 - padding .6rem .3rem - margin-top .5rem - -.comment - margin-bottom 1rem - - .date - .ship - max-width 12rem - margin-right 1rem - - .body - margin-top 1rem - - &.new .input - max-width 31rem - margin-top 1rem - -/* global */ - -.top - vertical-align top - -.ib - display inline-block - -.hidden - display none - -.a - display inline - cursor pointer - text-decoration underline - -.input - padding 0 .6rem 0 .3rem - background-color #ececec - border 0 - font inherit - resize none - -webkit-user-select text - user-select text - -textarea:focus -.input:focus - background-color #e6e6e6 - -.invalid .input - color red - -.caret.left - border-left 12px solid #000 - border-top 9px solid transparent - border-right 9px solid transparent - border-bottom 9px solid transparent - margin-top .4rem - -.s-1 .caret -.caret.down - border-left 6px solid transparent - border-top 6px solid #fff - border-right 6px solid transparent - border-bottom 6px solid transparent - -.s--1 .caret -.caret.up - border-left 6px solid transparent - border-top 6px solid transparent - border-right 6px solid transparent - border-bottom 6px solid #fff - -.hr1 - height .2rem - width 6rem - background-color #ccc - margin-left 2.2rem - -.hr2 - height .1rem - width 3rem - background-color #ccc - -@import 'mobile' \ No newline at end of file diff --git a/pub/work/src/css/mobile.styl b/pub/work/src/css/mobile.styl deleted file mode 100644 index 58f5fa107b..0000000000 --- a/pub/work/src/css/mobile.styl +++ /dev/null @@ -1,86 +0,0 @@ -/* computers --------*/ -// @media only screen and (min-width: 1024px) - - -/* laptops / small screens ----------- */ -// @media only screen and (max-width: 1170px) - - -/* tablets + phones ----------- */ -// @media only screen and (min-width: 320px) and (max-width: 1024px) - -/* phones portrait and landscape ----------- */ -@media only screen and (min-device-width: 320px) and (max-device-width: 480px) - #c - width 100% - margin 0 - left .6rem - - h1 - font-size 1rem - - input - textarea - -webkit-appearance none - border-radius 0 - - .input - padding 0 .3rem 0 .1rem - - .ctrl - margin-top 1rem - - .ctrl .sorts - .ctrl .filters - margin-left 0 - - .ctrl .filters .done label - display none - - .ctrl .sort - padding .2rem .3rem - - .ctrl .filter - line-height 1.3rem - - .ctrl .sort label - .ctrl .filter label - font-size .7rem - letter-spacing .05rem - line-height 1.3rem - - .items - margin-left 0 - - .item - width auto - - .item .sort - display none - - .item .title - .item .date - .item .tags - min-width 4rem - max-width 6rem - overflow hidden - margin-left .3rem - - .item .expand - float right - margin-right .6rem - - .item .description - .item .discussion - margin .5rem 0 - - .item .description textarea - min-width 18rem - margin 0 - - .item .comment.new - max-width 18rem - - .item .submit - line-height 1.6rem - letter-spacing 0 \ No newline at end of file diff --git a/pub/work/src/js/actions/WorkActions.coffee b/pub/work/src/js/actions/WorkActions.coffee deleted file mode 100644 index c6116355c9..0000000000 --- a/pub/work/src/js/actions/WorkActions.coffee +++ /dev/null @@ -1,78 +0,0 @@ -Dispatcher = require '../dispatcher/Dispatcher.coffee' -Persistence = require '../persistence/Persistence.coffee' -{uuid32} = require '../util.coffee' - -module.exports = - newItem: ({before,after},_item={}) -> - item = - date_created: Date.now() - date_modified: Date.now() - creator: window.urb.ship - version: -1 - id: _item.id ? uuid32() - date_due: _item.date_due ? null - done: _item.done ? null - doer: _item.doer ? null - tags: _item.tags ? [] - title: _item.title ? '' - description: _item.description ? '' - discussion: _item.discussion ? [] - audience: _item.audience ? - [window.util.talk.mainStationPath window.urb.ship] - if item.date_due or item.title or item.description - item.version++ - Persistence.put new:item - Dispatcher.handleViewAction {type:'newItem', before, after, item} - - setItem: ({id,version},key,val) -> - version += 1 - key = key.split('_').join '-' - set = "#{key}": val - Persistence.put old:{id,dif:{set}} - Dispatcher.handleViewAction {type:'updateItem',id,version,key,val} - - ownItem: ({id,version},act) -> - version += 1 - Persistence.put old:{id,version,dif:doer:"#{act}":null} - - removeItem: ({id,version}) -> - if version >= 0 - Persistence.put old:{id,dif:set:audience:[]} - Dispatcher.handleViewAction {type:'archiveItem',id} - - setAudience: ({id},to) -> - Persistence.put old:{id,dif:set:audience:to} - Dispatcher.handleViewAction {type:'setAudienece',id,to} - - addComment: ({id,version},val) -> - version += 1 - Persistence.put old:{id,version,dif:add:comment:val} - - setFilter: (key,val,filters) -> - Dispatcher.handleViewAction {type:'setFilter', key,val} - filters[key] = val - Persistence.setLocal 'filters',filters - - setSort: (key,val,sorts) -> - Dispatcher.handleViewAction {type:'setSort',key,val} - sorts[key] = val - Persistence.setLocal 'sorts',sorts - - moveItem: (list,to,from) -> - Persistence.put {sort:list} - Dispatcher.handleViewAction {type:'moveItems',list,to,from} - - getLocal: (key)-> - Persistence.getLocal key,(e,r) -> - new Error(e) if e - return if r is null - obj = - type:"load#{key[0].toUpperCase()+key.slice(1)}" - obj[key] = r - Dispatcher.handleServerAction obj - - listenList: (type)-> - Persistence.subscribe type, (err,d)-> - if d? - {sort,tasks} = d.data - Dispatcher.handleServerAction {type:"getData",sort,tasks} diff --git a/pub/work/src/js/components/FieldComponent.coffee b/pub/work/src/js/components/FieldComponent.coffee deleted file mode 100644 index e4379ec2c6..0000000000 --- a/pub/work/src/js/components/FieldComponent.coffee +++ /dev/null @@ -1,95 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,textarea} = React.DOM - -WorkActions = require '../actions/WorkActions.coffee' - -module.exports = recl - displayName: 'Field' - getInitialState: -> invalid:no - shouldComponentUpdate: (props)-> - while @oldValue?.length - if @oldValue[0] is props.defaultValue - return false - else @oldValue.shift() - true - - render: -> - className = "#{@props.className ? @props._key} field ib" - if @state.invalid then className += " invalid" - - props = _.extend {}, @props, { - @onKeyUp - ref:'input' - defaultValue: @props.render @props.defaultValue - className: 'input ib' - } - - div {className}, - if @props.textarea then (textarea props) - else - props.contentEditable = true - props.dangerouslySetInnerHTML = - __html: $('
').text(props.defaultValue).html() - (div props) - - onKeyUp: (e) -> - $t = $(e.target).closest '.field' - _val = @getVal() - if @props.item.ghost and _val is "" - return - val = @parse _val - unless @validate val - @setState invalid:yes - return - @setState invalid:no - - unless @equal @props.defaultValue, val - @oldValue ?= [] - @oldValue.push val - if @to then clearTimeout @to - @to = setTimeout => - {item,_key,index} = @props - if item.version >= 0 - WorkActions.setItem item, _key, val - else WorkActions.newItem {}, - id: item.id - tags: item.tags - audience: item.audience - "#{_key}": val - ,1000 - - getVal: -> - if @props.textarea - $(@refs.input.getDOMNode()).val() - else $(@refs.input.getDOMNode()).text() - - parse: (text)-> switch @props._key - when 'tags' then text.trim().split(" ") - when 'audience' then text.trim().split(" ").map (a) -> "~#{a}".toLowerCase() - when 'date_due' - d = text.slice(1).replace(/\./g, "-") - return NaN if d.length < 8 - new Date(d).valueOf() - else text - - equal: (vol=(@parse ""),val) -> switch @props._key - when 'tags', 'audience' - (_.xor(vol,val).length is 0) - when 'date_due' - vol.valueOf() is val - else vol is val - - validate: (val) -> switch @props._key - when 'date_due' - !isNaN(val) - when 'audience' - for a in val - [ship,station,rest...] = a.split("/") - return no unless (rest.length is 0) and ship and station - return no if ship[0] isnt "~" - return no if ship < 3 - return no if station < 3 - yes - else yes - diff --git a/pub/work/src/js/components/FilterComponent.coffee b/pub/work/src/js/components/FilterComponent.coffee deleted file mode 100644 index 82350752d6..0000000000 --- a/pub/work/src/js/components/FilterComponent.coffee +++ /dev/null @@ -1,60 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,h1,label,button} = React.DOM - -module.exports = recl - onClick: (e) -> - switch @props.filters['done'] - when null - b = true - when true - b = false - when false - b = null - @props.onChange 'done',b - onKeyDown: (e) -> - if e.keyCode is 13 - e.stopPropagation() - e.preventDefault() - onKeyUp: (e) -> @change e - onBlur: (e) -> @change e - change: (e) -> - $t = $(e.target).closest('.filter') - txt = $t.find('.input').text().trim() - key = $t.attr('data-key') - if txt.length is 0 then txt = null - else switch key - when 'creator' then txt = "~#{txt}" - when 'audience' then txt = txt.split " " - when 'tags' then txt = [txt] - @props.onChange key,txt - - fields: [ {filter:'done', key:'done', title: ''}, - {filter:'owned', key:'creator', title: 'Owner:'}, - {filter:'doer', key:'doer', title: 'Doer:'} - {filter:'tag', key:'tags', title: 'Tag:'}, - {filter:'channel', key:'audience', title: 'Audience:'}, - ] - - render: -> - (div {className:'filters'}, @fields.map ({filter,key,title})=> - txt = @props.filters[key] - txt = txt?.replace(/\~/g,"") if key is 'creator' - - (div {key, 'data-key':key, className:"#{filter} filter ib"}, - (label {}, title) - switch filter - when 'done' - (button { - className:'input-bool ib '+@props.filters[key], - @onClick - },"") - else - (div { - contentEditable:true - className:'input ib' - @onKeyDown - @onKeyUp - @onBlur - },txt) - )) diff --git a/pub/work/src/js/components/ItemComponent.coffee b/pub/work/src/js/components/ItemComponent.coffee deleted file mode 100644 index f7cb125ffd..0000000000 --- a/pub/work/src/js/components/ItemComponent.coffee +++ /dev/null @@ -1,162 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,textarea,button} = React.DOM - -WorkActions = require '../actions/WorkActions.coffee' -Field = require './FieldComponent.coffee' - -module.exports = recl - displayName: 'Item' - onDragStart: (e) -> - unless @props.draggable - e.preventDefault() - return - $t = $(e.target) - @dragged = $t.closest('.item') - e.dataTransfer.effectAllowed = 'move' - e.dataTransfer.setData 'text/html',e.currentTarget - @props._dragStart e,@ - - onDragEnd: (e) -> @props._dragEnd e,@ - - onKeyDown: (e) -> - @props.title_keyDown e,@ - - kc = e.keyCode - - switch kc - # tab - expand - when 9 - if @state.expand is false - @setState {expand:true} - # esc - collapse - when 27 - @setState {expand:false} - - if (kc is 9 and @state.expand is false) or (kc is 27) - e.preventDefault() - return - - onFocus: (e) -> @props._focus e,@ - - _markDone: (e) -> - WorkActions.setItem @props.item,'done',(not (@props.item.done is true)) - - getStatus: -> switch @props.item.doer - when window.urb.ship then "owned" - when undefined then "" - when null then "available" - else "taken: ~"+@props.item.doer - - getAction: -> switch @props.item.doer - when null - action = "claim" - when window.urb.ship - action = "release" - else "" - - _changeStatus: (e) -> - return if @props.item.status is 'released' - if @props.item.status is 'accepted' and - @formatCreator(@props.item.creator) isnt window.urb.ship - return - WorkActions.ownItem @props.item,@getAction() - - _submitComment: (e) -> - $input = $(e.target).closest('.item').find('.comment .input') - val = $input.text() - return if val.length is 0 - WorkActions.addComment @props.item,val - $input.text('') - - formatDate: (d,l) -> - unless d - return "" - _d = "~#{d.getFullYear()}.#{(d.getMonth()+1)}.#{d.getDate()}" - if l - _d += "..#{d.getHours()}.#{d.getMinutes()}.#{d.getSeconds()}" - _d - - formatCreator: (o="") -> o.replace /\~/g,"" - - formatAudience: (a=[]) -> @formatCreator a.join(" ") - - getInitialState: -> {expand:false} - - renderField: (_key,props,render=_.identity)-> - {item,index} = @props - defaultValue = item[_key] - rece Field, $.extend props, {render,_key,defaultValue,item,index} - - renderTopField: (key,props,format)-> - _props = _.extend props,{className:"#{props.className ? key} top"} - @renderField key,_props,format - - componentDidMount: -> - setInterval => - $('.new.comment .date').text @formatDate new Date - , 1000 - - render: -> - itemClass = 'item' - if @state.expand then itemClass += ' expand' - - discussion = _.clone @props.item.discussion ? [] - discussion.reverse() - - status = @getStatus() - action = @getAction() - - (div { - className:itemClass - draggable:true - @onDragStart,@onDragEnd - }, - (div { - className:'header' - }, - (div {className:'creator ib'}, @formatCreator(@props.item.creator)) - (div { - className:'status ib action-'+(action.length > 0) - 'data-key':'status' - onClick:@_changeStatus - }, - (div {className:'label'}, status) - (div {className:'action a'}, action) - ) - (@renderField 'audience', {}, @formatAudience) - ) - (div {className:'sort ib'}, '') - (button {className:'done ib done-'+(@props.item.done is true), onClick:@_markDone}, '') - (@renderTopField 'title', {@onFocus,@onKeyDown}) - (@renderTopField 'date_due', {className:'date'}, @formatDate) - (@renderTopField 'tags', {}, (tags=[])-> tags.join(" ")) - (div { - className:'expand ib', - onClick: (e) => @setState {expand:!@state.expand} - }, (div {className:'caret left'},"") - ) - (@renderField 'description',textarea: yes) - - (div {className:"hr"},"") - if discussion? - (div {className:"discussion"}, - (div {className:"comments"}, discussion.map (slug) => - (div {className:'comment',key:slug.date}, - (div {className:'hr2'},"") - (div {className:'ship ib'}, slug.ship) - (div {className:'date ib'}, @formatDate slug.date,true) - (div {className:'body'}, slug.body) - ) - ), - (div {className:'new comment'}, - (div {className:'hr2'},"") - (div {className:'ship ib'}, window.urb.ship) - (div {className:'date ib'}, @formatDate new Date) - (div { - contentEditable:true, - className:'input'}) - (button {className:'submit',onClick:@_submitComment},'Post') - ) - ) - ) diff --git a/pub/work/src/js/components/ListComponent.coffee b/pub/work/src/js/components/ListComponent.coffee deleted file mode 100644 index 27a9302d5b..0000000000 --- a/pub/work/src/js/components/ListComponent.coffee +++ /dev/null @@ -1,175 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,h1,input,textarea} = React.DOM - -WorkStore = require '../stores/WorkStore.coffee' -WorkActions = require '../actions/WorkActions.coffee' -ItemComponent = require './ItemComponent.coffee' - -ListeningComponent = require './ListeningComponent.coffee' -FilterComponent = require './FilterComponent.coffee' -SortComponent = require './SortComponent.coffee' - -module.exports = recl - displayName: 'List' - stateFromStore: -> window.canSort = WorkStore.canSort(); { - list:WorkStore.getList() - noNew:WorkStore.noNew() - canSort:WorkStore.canSort() - fulllist:WorkStore.getFullList() - sorts:WorkStore.getSorts() - filters:WorkStore.getFilters() - expand:false - updated:WorkStore.getUpdated() - } - - getInitialState: -> @stateFromStore() - _onChangeStore: -> @setState @stateFromStore() - - alias: -> - @$el = $ @getDOMNode() - @$items = @$el.find('.items').children() - - _focus: (e,i) -> @setState {selected:i.props.index} - - _dragStart: (e,i) -> @dragged = i.dragged - - _dragEnd: (e,i) -> - from = Number @dragged.closest('.item-wrap').attr('data-index') - to = Number @over.closest('.item-wrap').attr('data-index') - if from= 0) - WorkActions.moveItem list, to, from - @dragged.removeClass 'hidden' - @placeholder.remove() - - _dragOver: (e,i) -> - e.preventDefault() - $t = $(e.target).closest('.item') - if $t.hasClass 'placeholder' then return - if $t.length is 0 then return - @over = $t - if not @dragged.hasClass('hidden') then @dragged.addClass 'hidden' - if (e.clientY - $t[0].offsetTop) < ($t[0].offsetHeight / 2) - @drop = 'before' - @placeholder.insertBefore $t - else - @drop = 'after' - @placeholder.insertAfter $t - - title_keyDown: (e,i) -> switch e.keyCode - # enter - add new - when 13 - e.preventDefault() - return if @state.noNew - {item} = i.props - after = null; before = null - if window.getSelection().getRangeAt(0).endOffset is 0 - ins = @state.selected - before = item.id - else - after = item.id - ins = @state.selected+1 # XX consolidate - @setState {selected:ins,select:true} - unless item.ghost - {tags,audience} = item - item = {tags,audience} - WorkActions.newItem {before,after}, item - # backspace - remove if at 0 - when 8 - if (window.getSelection().getRangeAt(0).endOffset is 0) - e.preventDefault() - if (e.target.innerText.length is 0) - if @state.selected isnt 0 - @setState {selected:@state.selected-1,select:"end"} - WorkActions.removeItem i.props.item - else if ({index} = i.props; index > 0) and - (prev = @state.list[i.props.index - 1]; prev.version < 0) - WorkActions.removeItem prev - # up - when 38 - e.preventDefault() - last = @state.selected-1 - if last<0 then last = @state.list.length-1 - @$items.eq(last).find('.title .input').focus() - @setState {select:"end"} - # down - when 40 - e.preventDefault() - next = @state.selected+1 - if next is @state.list.length then next = 0 - @$items.eq(next).find('.title .input').focus() - @setState {select:"end"} - - _changeListening: -> - - _changeFilter: (key,val) -> WorkActions.setFilter key,val,@state.filters - - _changeSort: (key,val) -> WorkActions.setSort key,val,@state.sorts - - componentDidMount: -> - @placeholder = $ "
x
" - WorkStore.addChangeListener @_onChangeStore - WorkActions.listenList @props.list - WorkActions.getLocal 'filters' - WorkActions.getLocal 'sorts' - @alias() - - componentDidUpdate: (_props,_state)-> - @alias() - if @state.select - $title = @$items.eq(@state.selected).find('.title .input') - if @state.selected? - $title.focus() - if @state.select is "end" - r = window.getSelection().getRangeAt(0) - r.setStart $title[0],0 - r.setEnd $title[0],0 - s = window.getSelection() - s.removeAllRanges() - s.addRange r - @setState {select:false} - - render: -> - (div {}, - (div {className:'ctrl'}, - rece(ListeningComponent, { - listening:@state.listening - onChange:@_changeListening - }) - (div {className:'transforms'}, - rece(FilterComponent, { - filters:@state.filters - onChange:@_changeFilter - }) - rece(SortComponent, { - sorts:@state.sorts - onChange:@_changeSort - }) - ) - ) - (div { - className:'items' - onDragOver:@_dragOver - }, _.map @state.list,(item,index) => - className = "item-wrap" - key = item.id - draggable = @state.canSort - if item.ghost - className += " ghost" - draggable = false - (div {className,key,'data-index':index}, - rece(ItemComponent,{ - item - index - draggable - @_focus - @title_keyDown - @_dragStart - @_dragEnd}) - ) - ) - ) diff --git a/pub/work/src/js/components/ListeningComponent.coffee b/pub/work/src/js/components/ListeningComponent.coffee deleted file mode 100644 index edada9a164..0000000000 --- a/pub/work/src/js/components/ListeningComponent.coffee +++ /dev/null @@ -1,7 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,h1,input,textarea} = React.DOM - -module.exports = recl - render: -> - (div {className:'listening'}, "") diff --git a/pub/work/src/js/components/SortComponent.coffee b/pub/work/src/js/components/SortComponent.coffee deleted file mode 100644 index 535200fdfc..0000000000 --- a/pub/work/src/js/components/SortComponent.coffee +++ /dev/null @@ -1,27 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,h1,button,label} = React.DOM - -module.exports = recl - onClick: (e) -> - $t = $(e.target).closest '.sort' - key = $t.attr('data-key') - sor = Number $t.attr 'data-state' - if sor is 0 then sor = 1 - else if sor is 1 then sor = -1 - else if sor is -1 then sor = 0 - @props.onChange key,sor - - render: -> - (div {className:'sorts'}, _.map @props.sorts,(state,key) => - (button { - key - @onClick - 'data-key':key - 'data-state':state - className:"sort s-#{state}" - }, - (label {}, key) - (div {className:'caret ib'}, '') - ) - ) diff --git a/pub/work/src/js/components/WorkComponent.coffee b/pub/work/src/js/components/WorkComponent.coffee deleted file mode 100644 index a7663046a3..0000000000 --- a/pub/work/src/js/components/WorkComponent.coffee +++ /dev/null @@ -1,12 +0,0 @@ -recl = React.createClass -rece = React.createElement -{div,h1} = React.DOM - -ListComponent = require './ListComponent.coffee' - -module.exports = recl - render: -> - (div {}, - (h1 {className:'leader'}, "Work") - (rece(ListComponent,{list:'upcoming'})) - ) diff --git a/pub/work/src/js/dispatcher/dispatcher.coffee b/pub/work/src/js/dispatcher/dispatcher.coffee deleted file mode 100644 index 4e65c7a0c5..0000000000 --- a/pub/work/src/js/dispatcher/dispatcher.coffee +++ /dev/null @@ -1,13 +0,0 @@ -Dispatcher = require('flux').Dispatcher - -module.exports = _.merge new Dispatcher(), { - handleServerAction: (action) -> - @dispatch - source: 'server' - action: action - - handleViewAction: (action) -> - @dispatch - source: 'view' - action: action -} \ No newline at end of file diff --git a/pub/work/src/js/main.coffee b/pub/work/src/js/main.coffee deleted file mode 100644 index e0f47bc08a..0000000000 --- a/pub/work/src/js/main.coffee +++ /dev/null @@ -1,5 +0,0 @@ -WorkComponent = require './components/WorkComponent.coffee' -window.util = _.extend window.util || {}, require './util.coffee' - -$ -> - React.render React.createElement(WorkComponent),$('#c')[0] diff --git a/pub/work/src/js/main.js b/pub/work/src/js/main.js deleted file mode 100644 index b2a55036b9..0000000000 --- a/pub/work/src/js/main.js +++ /dev/null @@ -1,2161 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) { - Persistence.put({ - old: { - id: id, - dif: { - set: { - audience: [] - } - } - } - }); - } - return Dispatcher.handleViewAction({ - type: 'archiveItem', - id: id - }); - }, - setAudience: function(arg, to) { - var id; - id = arg.id; - Persistence.put({ - old: { - id: id, - dif: { - set: { - audience: to - } - } - } - }); - return Dispatcher.handleViewAction({ - type: 'setAudienece', - id: id, - to: to - }); - }, - addComment: function(arg, val) { - var id, version; - id = arg.id, version = arg.version; - version += 1; - return Persistence.put({ - old: { - id: id, - version: version, - dif: { - add: { - comment: val - } - } - } - }); - }, - setFilter: function(key, val, filters) { - Dispatcher.handleViewAction({ - type: 'setFilter', - key: key, - val: val - }); - filters[key] = val; - return Persistence.setLocal('filters', filters); - }, - setSort: function(key, val, sorts) { - Dispatcher.handleViewAction({ - type: 'setSort', - key: key, - val: val - }); - sorts[key] = val; - return Persistence.setLocal('sorts', sorts); - }, - moveItem: function(list, to, from) { - Persistence.put({ - sort: list - }); - return Dispatcher.handleViewAction({ - type: 'moveItems', - list: list, - to: to, - from: from - }); - }, - getLocal: function(key) { - return Persistence.getLocal(key, function(e, r) { - var obj; - if (e) { - new Error(e); - } - if (r === null) { - return; - } - obj = { - type: "load" + (key[0].toUpperCase() + key.slice(1)) - }; - obj[key] = r; - return Dispatcher.handleServerAction(obj); - }); - }, - listenList: function(type) { - return Persistence.subscribe(type, function(err, d) { - var ref, sort, tasks; - if (d != null) { - ref = d.data, sort = ref.sort, tasks = ref.tasks; - return Dispatcher.handleServerAction({ - type: "getData", - sort: sort, - tasks: tasks - }); - } - }); - } -}; - - -},{"../dispatcher/Dispatcher.coffee":9,"../persistence/Persistence.coffee":15,"../util.coffee":17}],2:[function(require,module,exports){ -var WorkActions, div, rece, recl, ref, textarea, - slice = [].slice; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, textarea = ref.textarea; - -WorkActions = require('../actions/WorkActions.coffee'); - -module.exports = recl({ - displayName: 'Field', - getInitialState: function() { - return { - invalid: false - }; - }, - shouldComponentUpdate: function(props) { - var ref1; - while ((ref1 = this.oldValue) != null ? ref1.length : void 0) { - if (this.oldValue[0] === props.defaultValue) { - return false; - } else { - this.oldValue.shift(); - } - } - return true; - }, - render: function() { - var className, props, ref1; - className = ((ref1 = this.props.className) != null ? ref1 : this.props._key) + " field ib"; - if (this.state.invalid) { - className += " invalid"; - } - props = _.extend({}, this.props, { - onKeyUp: this.onKeyUp, - ref: 'input', - defaultValue: this.props.render(this.props.defaultValue), - className: 'input ib' - }); - return div({ - className: className - }, this.props.textarea ? textarea(props) : (props.contentEditable = true, props.dangerouslySetInnerHTML = { - __html: $('
').text(props.defaultValue).html() - }, div(props))); - }, - onKeyUp: function(e) { - var $t, _val, val; - $t = $(e.target).closest('.field'); - _val = this.getVal(); - if (this.props.item.ghost && _val === "") { - return; - } - val = this.parse(_val); - if (!this.validate(val)) { - this.setState({ - invalid: true - }); - return; - } - this.setState({ - invalid: false - }); - if (!this.equal(this.props.defaultValue, val)) { - if (this.oldValue == null) { - this.oldValue = []; - } - this.oldValue.push(val); - if (this.to) { - clearTimeout(this.to); - } - return this.to = setTimeout((function(_this) { - return function() { - var _key, index, item, obj, ref1; - ref1 = _this.props, item = ref1.item, _key = ref1._key, index = ref1.index; - if (item.version >= 0) { - return WorkActions.setItem(item, _key, val); - } else { - return WorkActions.newItem({}, ( - obj = { - id: item.id, - tags: item.tags, - audience: item.audience - }, - obj["" + _key] = val, - obj - )); - } - }; - })(this), 1000); - } - }, - getVal: function() { - if (this.props.textarea) { - return $(this.refs.input.getDOMNode()).val(); - } else { - return $(this.refs.input.getDOMNode()).text(); - } - }, - parse: function(text) { - var d; - switch (this.props._key) { - case 'tags': - return text.trim().split(" "); - case 'audience': - return text.trim().split(" ").map(function(a) { - return ("~" + a).toLowerCase(); - }); - case 'date_due': - d = text.slice(1).replace(/\./g, "-"); - if (d.length < 8) { - return NaN; - } - return new Date(d).valueOf(); - default: - return text; - } - }, - equal: function(vol, val) { - if (vol == null) { - vol = this.parse(""); - } - switch (this.props._key) { - case 'tags': - case 'audience': - return _.xor(vol, val).length === 0; - case 'date_due': - return vol.valueOf() === val; - default: - return vol === val; - } - }, - validate: function(val) { - var a, i, len, ref1, rest, ship, station; - switch (this.props._key) { - case 'date_due': - return !isNaN(val); - case 'audience': - for (i = 0, len = val.length; i < len; i++) { - a = val[i]; - ref1 = a.split("/"), ship = ref1[0], station = ref1[1], rest = 3 <= ref1.length ? slice.call(ref1, 2) : []; - if (!((rest.length === 0) && ship && station)) { - return false; - } - if (ship[0] !== "~") { - return false; - } - if (ship < 3) { - return false; - } - if (station < 3) { - return false; - } - } - return true; - default: - return true; - } - } -}); - - -},{"../actions/WorkActions.coffee":1}],3:[function(require,module,exports){ -var button, div, h1, label, rece, recl, ref; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, h1 = ref.h1, label = ref.label, button = ref.button; - -module.exports = recl({ - onClick: function(e) { - var b; - switch (this.props.filters['done']) { - case null: - b = true; - break; - case true: - b = false; - break; - case false: - b = null; - } - return this.props.onChange('done', b); - }, - onKeyDown: function(e) { - if (e.keyCode === 13) { - e.stopPropagation(); - return e.preventDefault(); - } - }, - onKeyUp: function(e) { - return this.change(e); - }, - onBlur: function(e) { - return this.change(e); - }, - change: function(e) { - var $t, key, txt; - $t = $(e.target).closest('.filter'); - txt = $t.find('.input').text().trim(); - key = $t.attr('data-key'); - if (txt.length === 0) { - txt = null; - } else { - switch (key) { - case 'creator': - txt = "~" + txt; - break; - case 'audience': - txt = txt.split(" "); - break; - case 'tags': - txt = [txt]; - } - } - return this.props.onChange(key, txt); - }, - fields: [ - { - filter: 'done', - key: 'done', - title: '' - }, { - filter: 'owned', - key: 'creator', - title: 'Owner:' - }, { - filter: 'doer', - key: 'doer', - title: 'Doer:' - }, { - filter: 'tag', - key: 'tags', - title: 'Tag:' - }, { - filter: 'channel', - key: 'audience', - title: 'Audience:' - } - ], - render: function() { - return div({ - className: 'filters' - }, this.fields.map((function(_this) { - return function(arg) { - var filter, key, title, txt; - filter = arg.filter, key = arg.key, title = arg.title; - txt = _this.props.filters[key]; - if (key === 'creator') { - txt = txt != null ? txt.replace(/\~/g, "") : void 0; - } - return div({ - key: key, - 'data-key': key, - className: filter + " filter ib" - }, label({}, title), (function() { - switch (filter) { - case 'done': - return button({ - className: 'input-bool ib ' + this.props.filters[key], - onClick: this.onClick - }, ""); - default: - return div({ - contentEditable: true, - className: 'input ib', - onKeyDown: this.onKeyDown, - onKeyUp: this.onKeyUp, - onBlur: this.onBlur - }, txt); - } - }).call(_this)); - }; - })(this))); - } -}); - - -},{}],4:[function(require,module,exports){ -var Field, WorkActions, button, div, rece, recl, ref, textarea; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, textarea = ref.textarea, button = ref.button; - -WorkActions = require('../actions/WorkActions.coffee'); - -Field = require('./FieldComponent.coffee'); - -module.exports = recl({ - displayName: 'Item', - onDragStart: function(e) { - var $t; - if (!this.props.draggable) { - e.preventDefault(); - return; - } - $t = $(e.target); - this.dragged = $t.closest('.item'); - e.dataTransfer.effectAllowed = 'move'; - e.dataTransfer.setData('text/html', e.currentTarget); - return this.props._dragStart(e, this); - }, - onDragEnd: function(e) { - return this.props._dragEnd(e, this); - }, - onKeyDown: function(e) { - var kc; - this.props.title_keyDown(e, this); - kc = e.keyCode; - switch (kc) { - case 9: - if (this.state.expand === false) { - this.setState({ - expand: true - }); - } - break; - case 27: - this.setState({ - expand: false - }); - } - if ((kc === 9 && this.state.expand === false) || (kc === 27)) { - e.preventDefault(); - } - }, - onFocus: function(e) { - return this.props._focus(e, this); - }, - _markDone: function(e) { - return WorkActions.setItem(this.props.item, 'done', !(this.props.item.done === true)); - }, - getStatus: function() { - switch (this.props.item.doer) { - case window.urb.ship: - return "owned"; - case void 0: - return ""; - case null: - return "available"; - default: - return "taken: ~" + this.props.item.doer; - } - }, - getAction: function() { - var action; - switch (this.props.item.doer) { - case null: - return action = "claim"; - case window.urb.ship: - return action = "release"; - default: - return ""; - } - }, - _changeStatus: function(e) { - if (this.props.item.status === 'released') { - return; - } - if (this.props.item.status === 'accepted' && this.formatCreator(this.props.item.creator) !== window.urb.ship) { - return; - } - return WorkActions.ownItem(this.props.item, this.getAction()); - }, - _submitComment: function(e) { - var $input, val; - $input = $(e.target).closest('.item').find('.comment .input'); - val = $input.text(); - if (val.length === 0) { - return; - } - WorkActions.addComment(this.props.item, val); - return $input.text(''); - }, - formatDate: function(d, l) { - var _d; - if (!d) { - return ""; - } - _d = "~" + (d.getFullYear()) + "." + (d.getMonth() + 1) + "." + (d.getDate()); - if (l) { - _d += ".." + (d.getHours()) + "." + (d.getMinutes()) + "." + (d.getSeconds()); - } - return _d; - }, - formatCreator: function(o) { - if (o == null) { - o = ""; - } - return o.replace(/\~/g, ""); - }, - formatAudience: function(a) { - if (a == null) { - a = []; - } - return this.formatCreator(a.join(" ")); - }, - getInitialState: function() { - return { - expand: false - }; - }, - renderField: function(_key, props, render) { - var defaultValue, index, item, ref1; - if (render == null) { - render = _.identity; - } - ref1 = this.props, item = ref1.item, index = ref1.index; - defaultValue = item[_key]; - return rece(Field, $.extend(props, { - render: render, - _key: _key, - defaultValue: defaultValue, - item: item, - index: index - })); - }, - renderTopField: function(key, props, format) { - var _props, ref1; - _props = _.extend(props, { - className: ((ref1 = props.className) != null ? ref1 : key) + " top" - }); - return this.renderField(key, _props, format); - }, - componentDidMount: function() { - return setInterval((function(_this) { - return function() { - return $('.new.comment .date').text(_this.formatDate(new Date)); - }; - })(this), 1000); - }, - render: function() { - var action, discussion, itemClass, ref1, status; - itemClass = 'item'; - if (this.state.expand) { - itemClass += ' expand'; - } - discussion = _.clone((ref1 = this.props.item.discussion) != null ? ref1 : []); - discussion.reverse(); - status = this.getStatus(); - action = this.getAction(); - return div({ - className: itemClass, - draggable: true, - onDragStart: this.onDragStart, - onDragEnd: this.onDragEnd - }, div({ - className: 'header' - }, div({ - className: 'creator ib' - }, this.formatCreator(this.props.item.creator)), div({ - className: 'status ib action-' + (action.length > 0), - 'data-key': 'status', - onClick: this._changeStatus - }, div({ - className: 'label' - }, status), div({ - className: 'action a' - }, action)), this.renderField('audience', {}, this.formatAudience)), div({ - className: 'sort ib' - }, ''), button({ - className: 'done ib done-' + (this.props.item.done === true), - onClick: this._markDone - }, ''), this.renderTopField('title', { - onFocus: this.onFocus, - onKeyDown: this.onKeyDown - }), this.renderTopField('date_due', { - className: 'date' - }, this.formatDate), this.renderTopField('tags', {}, function(tags) { - if (tags == null) { - tags = []; - } - return tags.join(" "); - }), div({ - className: 'expand ib', - onClick: (function(_this) { - return function(e) { - return _this.setState({ - expand: !_this.state.expand - }); - }; - })(this) - }, div({ - className: 'caret left' - }, "")), this.renderField('description', { - textarea: true - }), div({ - className: "hr" - }, ""), discussion != null ? div({ - className: "discussion" - }, div({ - className: "comments" - }, discussion.map((function(_this) { - return function(slug) { - return div({ - className: 'comment', - key: slug.date - }, div({ - className: 'hr2' - }, ""), div({ - className: 'ship ib' - }, slug.ship), div({ - className: 'date ib' - }, _this.formatDate(slug.date, true)), div({ - className: 'body' - }, slug.body)); - }; - })(this))), div({ - className: 'new comment' - }, div({ - className: 'hr2' - }, ""), div({ - className: 'ship ib' - }, window.urb.ship), div({ - className: 'date ib' - }, this.formatDate(new Date)), div({ - contentEditable: true, - className: 'input' - }), button({ - className: 'submit', - onClick: this._submitComment - }, 'Post'))) : void 0); - } -}); - - -},{"../actions/WorkActions.coffee":1,"./FieldComponent.coffee":2}],5:[function(require,module,exports){ -var FilterComponent, ItemComponent, ListeningComponent, SortComponent, WorkActions, WorkStore, div, h1, input, rece, recl, ref, textarea; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, h1 = ref.h1, input = ref.input, textarea = ref.textarea; - -WorkStore = require('../stores/WorkStore.coffee'); - -WorkActions = require('../actions/WorkActions.coffee'); - -ItemComponent = require('./ItemComponent.coffee'); - -ListeningComponent = require('./ListeningComponent.coffee'); - -FilterComponent = require('./FilterComponent.coffee'); - -SortComponent = require('./SortComponent.coffee'); - -module.exports = recl({ - displayName: 'List', - stateFromStore: function() { - window.canSort = WorkStore.canSort(); - return { - list: WorkStore.getList(), - noNew: WorkStore.noNew(), - canSort: WorkStore.canSort(), - fulllist: WorkStore.getFullList(), - sorts: WorkStore.getSorts(), - filters: WorkStore.getFilters(), - expand: false, - updated: WorkStore.getUpdated() - }; - }, - getInitialState: function() { - return this.stateFromStore(); - }, - _onChangeStore: function() { - return this.setState(this.stateFromStore()); - }, - alias: function() { - this.$el = $(this.getDOMNode()); - return this.$items = this.$el.find('.items').children(); - }, - _focus: function(e, i) { - return this.setState({ - selected: i.props.index - }); - }, - _dragStart: function(e, i) { - return this.dragged = i.dragged; - }, - _dragEnd: function(e, i) { - var from, id, list, sort, to, version; - from = Number(this.dragged.closest('.item-wrap').attr('data-index')); - to = Number(this.over.closest('.item-wrap').attr('data-index')); - if (from < to) { - to--; - } - if (this.drop === 'after') { - to++; - } - sort = _.clone(this.state.list); - sort.splice(to, 0, sort.splice(from, 1)[0]); - list = (function() { - var j, len, ref1, results; - results = []; - for (j = 0, len = sort.length; j < len; j++) { - ref1 = sort[j], id = ref1.id, version = ref1.version; - if ((version != null ? version : -1) >= 0) { - results.push(id); - } - } - return results; - })(); - WorkActions.moveItem(list, to, from); - this.dragged.removeClass('hidden'); - return this.placeholder.remove(); - }, - _dragOver: function(e, i) { - var $t; - e.preventDefault(); - $t = $(e.target).closest('.item'); - if ($t.hasClass('placeholder')) { - return; - } - if ($t.length === 0) { - return; - } - this.over = $t; - if (!this.dragged.hasClass('hidden')) { - this.dragged.addClass('hidden'); - } - if ((e.clientY - $t[0].offsetTop) < ($t[0].offsetHeight / 2)) { - this.drop = 'before'; - return this.placeholder.insertBefore($t); - } else { - this.drop = 'after'; - return this.placeholder.insertAfter($t); - } - }, - title_keyDown: function(e, i) { - var after, audience, before, index, ins, item, last, next, prev, ref1, tags; - switch (e.keyCode) { - case 13: - e.preventDefault(); - if (this.state.noNew) { - return; - } - item = i.props.item; - after = null; - before = null; - if (window.getSelection().getRangeAt(0).endOffset === 0) { - ins = this.state.selected; - before = item.id; - } else { - after = item.id; - ins = this.state.selected + 1; - this.setState({ - selected: ins, - select: true - }); - } - if (!item.ghost) { - tags = item.tags, audience = item.audience; - item = { - tags: tags, - audience: audience - }; - } - return WorkActions.newItem({ - before: before, - after: after - }, item); - case 8: - if (window.getSelection().getRangeAt(0).endOffset === 0) { - e.preventDefault(); - if (e.target.innerText.length === 0) { - if (this.state.selected !== 0) { - this.setState({ - selected: this.state.selected - 1, - select: "end" - }); - } - return WorkActions.removeItem(i.props.item); - } else if (((ref1 = i.props, index = ref1.index, ref1), index > 0) && (prev = this.state.list[i.props.index - 1], prev.version < 0)) { - return WorkActions.removeItem(prev); - } - } - break; - case 38: - e.preventDefault(); - last = this.state.selected - 1; - if (last < 0) { - last = this.state.list.length - 1; - } - this.$items.eq(last).find('.title .input').focus(); - return this.setState({ - select: "end" - }); - case 40: - e.preventDefault(); - next = this.state.selected + 1; - if (next === this.state.list.length) { - next = 0; - } - this.$items.eq(next).find('.title .input').focus(); - return this.setState({ - select: "end" - }); - } - }, - _changeListening: function() {}, - _changeFilter: function(key, val) { - return WorkActions.setFilter(key, val, this.state.filters); - }, - _changeSort: function(key, val) { - return WorkActions.setSort(key, val, this.state.sorts); - }, - componentDidMount: function() { - this.placeholder = $("
x
"); - WorkStore.addChangeListener(this._onChangeStore); - WorkActions.listenList(this.props.list); - WorkActions.getLocal('filters'); - WorkActions.getLocal('sorts'); - return this.alias(); - }, - componentDidUpdate: function(_props, _state) { - var $title, r, s; - this.alias(); - if (this.state.select) { - $title = this.$items.eq(this.state.selected).find('.title .input'); - if (this.state.selected != null) { - $title.focus(); - } - if (this.state.select === "end") { - r = window.getSelection().getRangeAt(0); - r.setStart($title[0], 0); - r.setEnd($title[0], 0); - s = window.getSelection(); - s.removeAllRanges(); - s.addRange(r); - } - return this.setState({ - select: false - }); - } - }, - render: function() { - return div({}, div({ - className: 'ctrl' - }, rece(ListeningComponent, { - listening: this.state.listening, - onChange: this._changeListening - }), div({ - className: 'transforms' - }, rece(FilterComponent, { - filters: this.state.filters, - onChange: this._changeFilter - }), rece(SortComponent, { - sorts: this.state.sorts, - onChange: this._changeSort - }))), div({ - className: 'items', - onDragOver: this._dragOver - }, _.map(this.state.list, (function(_this) { - return function(item, index) { - var className, draggable, key; - className = "item-wrap"; - key = item.id; - draggable = _this.state.canSort; - if (item.ghost) { - className += " ghost"; - draggable = false; - } - return div({ - className: className, - key: key, - 'data-index': index - }, rece(ItemComponent, { - item: item, - index: index, - draggable: draggable, - _focus: _this._focus, - title_keyDown: _this.title_keyDown, - _dragStart: _this._dragStart, - _dragEnd: _this._dragEnd - })); - }; - })(this)))); - } -}); - - -},{"../actions/WorkActions.coffee":1,"../stores/WorkStore.coffee":16,"./FilterComponent.coffee":3,"./ItemComponent.coffee":4,"./ListeningComponent.coffee":6,"./SortComponent.coffee":7}],6:[function(require,module,exports){ -var div, h1, input, rece, recl, ref, textarea; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, h1 = ref.h1, input = ref.input, textarea = ref.textarea; - -module.exports = recl({ - render: function() { - return div({ - className: 'listening' - }, ""); - } -}); - - -},{}],7:[function(require,module,exports){ -var button, div, h1, label, rece, recl, ref; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, h1 = ref.h1, button = ref.button, label = ref.label; - -module.exports = recl({ - onClick: function(e) { - var $t, key, sor; - $t = $(e.target).closest('.sort'); - key = $t.attr('data-key'); - sor = Number($t.attr('data-state')); - if (sor === 0) { - sor = 1; - } else if (sor === 1) { - sor = -1; - } else if (sor === -1) { - sor = 0; - } - return this.props.onChange(key, sor); - }, - render: function() { - return div({ - className: 'sorts' - }, _.map(this.props.sorts, (function(_this) { - return function(state, key) { - return button({ - key: key, - onClick: _this.onClick, - 'data-key': key, - 'data-state': state, - className: "sort s-" + state - }, label({}, key), div({ - className: 'caret ib' - }, '')); - }; - })(this))); - } -}); - - -},{}],8:[function(require,module,exports){ -var ListComponent, div, h1, rece, recl, ref; - -recl = React.createClass; - -rece = React.createElement; - -ref = React.DOM, div = ref.div, h1 = ref.h1; - -ListComponent = require('./ListComponent.coffee'); - -module.exports = recl({ - render: function() { - return div({}, h1({ - className: 'leader' - }, "Work"), rece(ListComponent, { - list: 'upcoming' - })); - } -}); - - -},{"./ListComponent.coffee":5}],9:[function(require,module,exports){ -var Dispatcher; - -Dispatcher = require('flux').Dispatcher; - -module.exports = _.merge(new Dispatcher(), { - handleServerAction: function(action) { - return this.dispatch({ - source: 'server', - action: action - }); - }, - handleViewAction: function(action) { - return this.dispatch({ - source: 'view', - action: action - }); - } -}); - - -},{"flux":11}],10:[function(require,module,exports){ -var WorkComponent; - -WorkComponent = require('./components/WorkComponent.coffee'); - -window.util = _.extend(window.util || {}, require('./util.coffee')); - -$(function() { - return React.render(React.createElement(WorkComponent), $('#c')[0]); -}); - - -},{"./components/WorkComponent.coffee":8,"./util.coffee":17}],11:[function(require,module,exports){ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -module.exports.Dispatcher = require('./lib/Dispatcher') - -},{"./lib/Dispatcher":12}],12:[function(require,module,exports){ -/* - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule Dispatcher - * @typechecks - */ - -"use strict"; - -var invariant = require('./invariant'); - -var _lastID = 1; -var _prefix = 'ID_'; - -/** - * Dispatcher is used to broadcast payloads to registered callbacks. This is - * different from generic pub-sub systems in two ways: - * - * 1) Callbacks are not subscribed to particular events. Every payload is - * dispatched to every registered callback. - * 2) Callbacks can be deferred in whole or part until other callbacks have - * been executed. - * - * For example, consider this hypothetical flight destination form, which - * selects a default city when a country is selected: - * - * var flightDispatcher = new Dispatcher(); - * - * // Keeps track of which country is selected - * var CountryStore = {country: null}; - * - * // Keeps track of which city is selected - * var CityStore = {city: null}; - * - * // Keeps track of the base flight price of the selected city - * var FlightPriceStore = {price: null} - * - * When a user changes the selected city, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'city-update', - * selectedCity: 'paris' - * }); - * - * This payload is digested by `CityStore`: - * - * flightDispatcher.register(function(payload) { - * if (payload.actionType === 'city-update') { - * CityStore.city = payload.selectedCity; - * } - * }); - * - * When the user selects a country, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'country-update', - * selectedCountry: 'australia' - * }); - * - * This payload is digested by both stores: - * - * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * CountryStore.country = payload.selectedCountry; - * } - * }); - * - * When the callback to update `CountryStore` is registered, we save a reference - * to the returned token. Using this token with `waitFor()`, we can guarantee - * that `CountryStore` is updated before the callback that updates `CityStore` - * needs to query its data. - * - * CityStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * // `CountryStore.country` may not be updated. - * flightDispatcher.waitFor([CountryStore.dispatchToken]); - * // `CountryStore.country` is now guaranteed to be updated. - * - * // Select the default city for the new country - * CityStore.city = getDefaultCityForCountry(CountryStore.country); - * } - * }); - * - * The usage of `waitFor()` can be chained, for example: - * - * FlightPriceStore.dispatchToken = - * flightDispatcher.register(function(payload) { - * switch (payload.actionType) { - * case 'country-update': - * flightDispatcher.waitFor([CityStore.dispatchToken]); - * FlightPriceStore.price = - * getFlightPriceStore(CountryStore.country, CityStore.city); - * break; - * - * case 'city-update': - * FlightPriceStore.price = - * FlightPriceStore(CountryStore.country, CityStore.city); - * break; - * } - * }); - * - * The `country-update` payload will be guaranteed to invoke the stores' - * registered callbacks in order: `CountryStore`, `CityStore`, then - * `FlightPriceStore`. - */ - - function Dispatcher() { - this.$Dispatcher_callbacks = {}; - this.$Dispatcher_isPending = {}; - this.$Dispatcher_isHandled = {}; - this.$Dispatcher_isDispatching = false; - this.$Dispatcher_pendingPayload = null; - } - - /** - * Registers a callback to be invoked with every dispatched payload. Returns - * a token that can be used with `waitFor()`. - * - * @param {function} callback - * @return {string} - */ - Dispatcher.prototype.register=function(callback) { - var id = _prefix + _lastID++; - this.$Dispatcher_callbacks[id] = callback; - return id; - }; - - /** - * Removes a callback based on its token. - * - * @param {string} id - */ - Dispatcher.prototype.unregister=function(id) { - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', - id - ); - delete this.$Dispatcher_callbacks[id]; - }; - - /** - * Waits for the callbacks specified to be invoked before continuing execution - * of the current callback. This method should only be used by a callback in - * response to a dispatched payload. - * - * @param {array} ids - */ - Dispatcher.prototype.waitFor=function(ids) { - invariant( - this.$Dispatcher_isDispatching, - 'Dispatcher.waitFor(...): Must be invoked while dispatching.' - ); - for (var ii = 0; ii < ids.length; ii++) { - var id = ids[ii]; - if (this.$Dispatcher_isPending[id]) { - invariant( - this.$Dispatcher_isHandled[id], - 'Dispatcher.waitFor(...): Circular dependency detected while ' + - 'waiting for `%s`.', - id - ); - continue; - } - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', - id - ); - this.$Dispatcher_invokeCallback(id); - } - }; - - /** - * Dispatches a payload to all registered callbacks. - * - * @param {object} payload - */ - Dispatcher.prototype.dispatch=function(payload) { - invariant( - !this.$Dispatcher_isDispatching, - 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.' - ); - this.$Dispatcher_startDispatching(payload); - try { - for (var id in this.$Dispatcher_callbacks) { - if (this.$Dispatcher_isPending[id]) { - continue; - } - this.$Dispatcher_invokeCallback(id); - } - } finally { - this.$Dispatcher_stopDispatching(); - } - }; - - /** - * Is this Dispatcher currently dispatching. - * - * @return {boolean} - */ - Dispatcher.prototype.isDispatching=function() { - return this.$Dispatcher_isDispatching; - }; - - /** - * Call the callback stored with the given id. Also do some internal - * bookkeeping. - * - * @param {string} id - * @internal - */ - Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) { - this.$Dispatcher_isPending[id] = true; - this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload); - this.$Dispatcher_isHandled[id] = true; - }; - - /** - * Set up bookkeeping needed when dispatching. - * - * @param {object} payload - * @internal - */ - Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) { - for (var id in this.$Dispatcher_callbacks) { - this.$Dispatcher_isPending[id] = false; - this.$Dispatcher_isHandled[id] = false; - } - this.$Dispatcher_pendingPayload = payload; - this.$Dispatcher_isDispatching = true; - }; - - /** - * Clear bookkeeping used for dispatching. - * - * @internal - */ - Dispatcher.prototype.$Dispatcher_stopDispatching=function() { - this.$Dispatcher_pendingPayload = null; - this.$Dispatcher_isDispatching = false; - }; - - -module.exports = Dispatcher; - -},{"./invariant":13}],13:[function(require,module,exports){ -/** - * Copyright (c) 2014, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule invariant - */ - -"use strict"; - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } - - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -}; - -module.exports = invariant; - -},{}],14:[function(require,module,exports){ -'use strict'; - -function ToObject(val) { - if (val == null) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -module.exports = Object.assign || function (target, source) { - var pendingException; - var from; - var keys; - var to = ToObject(target); - - for (var s = 1; s < arguments.length; s++) { - from = arguments[s]; - keys = Object.keys(Object(from)); - - for (var i = 0; i < keys.length; i++) { - try { - to[keys[i]] = from[keys[i]]; - } catch (err) { - if (pendingException === undefined) { - pendingException = err; - } - } - } - } - - if (pendingException) { - throw pendingException; - } - - return to; -}; - -},{}],15:[function(require,module,exports){ -var cache, listeners; - -urb.appl = 'work'; - -listeners = {}; - -cache = null; - -urb.bind("/repo", function(err, dat) { - var cb, k, results; - if (err) { - return document.write(err); - } else { - cache = dat; - results = []; - for (k in listeners) { - cb = listeners[k]; - results.push(cb(null, dat)); - } - return results; - } -}); - -module.exports = { - put: function(update, cb) { - return urb.send(update, { - mark: 'work-command' - }, cb); - }, - subscribe: function(key, cb) { - listeners[key] = cb; - if (cache != null) { - return cb(null, cache); - } - }, - setLocal: function(key, val) { - return window.localStorage.setItem(key, JSON.stringify(val)); - }, - getLocal: function(key, cb) { - var e, out; - try { - out = JSON.parse(window.localStorage.getItem(key)); - return cb(null, out); - } catch (_error) { - e = _error; - return cb(e); - } - } -}; - - -},{}],16:[function(require,module,exports){ -var Dispatcher, EventEmitter, WorkStore, _filters, _ghost, _list, _listening, _sorts, _tasks, _updated, assign, uuid32; - -EventEmitter = require('events').EventEmitter; - -assign = require('object-assign'); - -Dispatcher = require('../dispatcher/Dispatcher.coffee'); - -uuid32 = require('../util.coffee').uuid32; - -_tasks = {}; - -_list = []; - -_listening = []; - -_updated = Date.now(); - -_filters = { - done: null, - creator: null, - doer: null, - audience: null, - tags: null -}; - -_sorts = { - sort: 0, - title: 0, - creator: 0, - date_due: 0 -}; - -_ghost = { - id: uuid32() -}; - -WorkStore = assign({}, EventEmitter.prototype, { - emitChange: function() { - return this.emit('change'); - }, - addChangeListener: function(cb) { - return this.on('change', cb); - }, - removeChangeListener: function(cb) { - return this.removeListener("change", cb); - }, - getData: function(arg) { - var sort, tasks; - sort = arg.sort, tasks = arg.tasks; - sort.map((function(_this) { - return function(id, index) { - if (!_tasks[id]) { - _list.splice(index, 0, id); - } - if (!tasks[id]) { - return console.log("lost", id); - } else if (!_tasks[id] || tasks[id].version > _tasks[id].version) { - return _tasks[id] = _this.itemFromData(tasks[id], index); - } - }; - })(this)); - return _updated = Date.now(); - }, - getUpdated: function() { - return _updated; - }, - getFullList: function() { - return _list; - }, - getList: function(key) { - var _k, _v, add, c, ghost, i, id, k, len, list, task, v; - list = []; - for (i = 0, len = _list.length; i < len; i++) { - id = _list[i]; - task = _tasks[id]; - if ((task == null) || task.archived) { - continue; - } - add = true; - for (_k in _filters) { - _v = _filters[_k]; - if (_v === null) { - continue; - } - c = task[_k]; - add = (function() { - switch (_k) { - case 'tags': - case 'audience': - return _.intersection(c, _v).length !== 0; - case 'creator': - return c === _v.replace(/\~/g, ""); - case 'done': - return !!c === _v; - default: - return c === _v; - } - })(); - if (!add) { - break; - } - } - if (add) { - list.push(task); - } - } - if (_.uniq(_.values(_sorts)).length > 1) { - for (k in _sorts) { - v = _sorts[k]; - if (v !== 0) { - break; - } - } - list = _.sortBy(list, k, k); - if (v === -1) { - list.reverse(); - } - } - if (!this.noNew()) { - ghost = $.extend({ - ghost: true, - version: -1 - }, _ghost); - if (_filters.tags) { - ghost.tags = _filters.tags; - } - if (_filters.audience) { - ghost.audience = _filters.audience; - } - list.push(ghost); - } - return list; - }, - newItem: function(arg) { - var after, before, index, item; - before = arg.before, after = arg.after, item = arg.item; - if (before) { - index = _list.indexOf(before); - if (index === -1) { - index = null; - } - } - if (after) { - index = 1 + _list.indexOf(after); - if (index === 0) { - index = null; - } - } - if (index == null) { - index = _list.length; - } - if (item.id === _ghost.id) { - _ghost.id = uuid32(); - } - if (_tasks[item.id] == null) { - _list.splice(index, 0, item.id); - } else if (_tasks[item.id].version >= 0) { - throw new Error("Collision: already have " + item.id); - } - return _tasks[item.id] = this.itemFromData(item, index); - }, - loadFilters: function(arg) { - var filters; - filters = arg.filters; - console.log('filters'); - console.log(filters); - return _filters = filters; - }, - getFilters: function() { - return _filters; - }, - setFilter: function(arg) { - var key, val; - key = arg.key, val = arg.val; - return _filters[key] = val; - }, - loadSorts: function(arg) { - var sorts; - sorts = arg.sorts; - console.log('load sorts'); - console.log(sorts); - return _sorts = sorts; - }, - getSorts: function() { - return _sorts; - }, - setSort: function(arg) { - var k, key, v, val; - key = arg.key, val = arg.val; - for (k in _sorts) { - v = _sorts[k]; - _sorts[k] = 0; - } - return _sorts[key] = val; - }, - canSort: function() { - var k, v; - for (k in _sorts) { - v = _sorts[k]; - if (k === "sort" && v === 1) { - return true; - } else if (v !== 0) { - return false; - } - } - return true; - }, - noNew: function() { - return (_filters.done === true) || (_filters.creator != null) && _filters.owner !== urb.ship; - }, - itemFromData: function(item, index) { - var _item; - if (index == null) { - index = 0; - } - _item = _.extend({ - sort: index - }, item); - _item.date_modified = new Date(item.date_modified); - _item.date_created = new Date(item.date_created); - if (item.date_due != null) { - _item.date_due = new Date(item.date_due); - } - if (item.done != null) { - _item.done = new Date(item.done); - } - _item.discussion = item.discussion.map(function(arg) { - var body, date, ship; - ship = arg.ship, body = arg.body, date = arg.date; - return { - ship: ship, - body: body, - date: new Date(date) - }; - }); - return _item; - }, - moveItems: function(arg) { - var from, list, to; - list = arg.list, to = arg.to, from = arg.from; - _tasks[_list[from]].sort = _tasks[_list[to]].sort; - return _list = list; - }, - setAudience: function(arg) { - var id, to; - id = arg.id, to = arg.to; - return _tasks[id].audience = to; - }, - archiveItem: function(arg) { - var id; - id = arg.id; - return _tasks[id].archived = true; - }, - updateItem: function(arg) { - var id, key, val, version; - id = arg.id, version = arg.version, key = arg.key, val = arg.val; - _tasks[id].version = version; - if (key === 'done') { - return _tasks[id].done = val; - } - } -}); - -WorkStore.setMaxListeners(100); - -WorkStore.dispatchToken = Dispatcher.register(function(p) { - var a; - a = p.action; - if (WorkStore[a.type]) { - WorkStore[a.type](a); - return WorkStore.emitChange(); - } -}); - -module.exports = WorkStore; - - -},{"../dispatcher/Dispatcher.coffee":9,"../util.coffee":17,"events":18,"object-assign":14}],17:[function(require,module,exports){ -module.exports = { - uuid32: function() { - var i, str, vals; - vals = (function() { - var j, results; - results = []; - for (i = j = 0; j <= 5; i = ++j) { - str = Math.ceil(Math.random() * 10000000).toString(32); - results.push(("00000" + str).substr(-5, 5)); - } - return results; - })(); - vals.unshift(Math.ceil(Math.random() * 8)); - return "0v" + vals.join('.'); - }, - getScroll: function() { - return this.writingPosition = $('#c').outerHeight(true) + $('#c').offset().top - $(window).height(); - }, - setScroll: function() { - window.util.getScroll(); - return $(window).scrollTop($("#c").height()); - }, - isScrolling: function() { - if (!window.util.writingPosition) { - window.util.getScroll(); - } - return $(window).scrollTop() + $('#writing').outerHeight() < window.util.writingPosition; - }, - checkScroll: function() { - if (window.util.isScrolling()) { - return $('body').addClass('scrolling'); - } else { - return $('body').removeClass('scrolling'); - } - }, - talk: { - mainStations: ["court", "floor", "porch"], - mainStationPath: function(user) { - return "~" + user + "/" + (window.util.talk.mainStation(user)); - }, - mainStation: function(user) { - if (!user) { - user = window.urb.user; - } - switch (user.length) { - case 3: - return "court"; - case 6: - return "floor"; - case 13: - return "porch"; - } - } - } -}; - - -},{}],18:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } - throw TypeError('Uncaught, unspecified "error" event.'); - } - } - - handler = this._events[type]; - - if (isUndefined(handler)) - return false; - - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; - -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } - - return this; -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); - - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - - g.listener = listener; - this.on(type, g); - - return this; -}; - -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events || !this._events[type]) - return this; - - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } - - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } - - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } - - return this; -}; - -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; - - if (!this._events) - return this; - - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - - listeners = this._events[type]; - - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; - - return this; -}; - -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; - -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; - -function isFunction(arg) { - return typeof arg === 'function'; -} - -function isNumber(arg) { - return typeof arg === 'number'; -} - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} - -function isUndefined(arg) { - return arg === void 0; -} - -},{}]},{},[10]); diff --git a/pub/work/src/js/package.json b/pub/work/src/js/package.json deleted file mode 100644 index 31d10a1d77..0000000000 --- a/pub/work/src/js/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "urbit-work", - "version": "0.0.0", - "repository": { - "type":"git", - "url":"https://github.com/urbit/urbit" - }, - "description": "urbit work frontend", - "main": "main.js", - "dependencies": { - "coffeeify": "~0.7.0", - "flux": "~2.0.1", - "lodash": "~2.4.1", - "moment-timezone": "~0.2.4", - "object-assign": "^1.0.0" - } -} diff --git a/pub/work/src/js/persistence/Persistence.coffee b/pub/work/src/js/persistence/Persistence.coffee deleted file mode 100644 index b07cb48ee7..0000000000 --- a/pub/work/src/js/persistence/Persistence.coffee +++ /dev/null @@ -1,21 +0,0 @@ -urb.appl = 'work' -listeners = {} -cache = null -urb.bind "/repo", (err,dat)-> - if err - document.write err - else - cache = dat - (cb null,dat) for k,cb of listeners -module.exports = - put: (update,cb) -> urb.send(update,{mark:'work-command'},cb) - subscribe: (key,cb) -> - listeners[key] = cb - (cb null,cache) if cache? - setLocal: (key,val) -> window.localStorage.setItem key,JSON.stringify val - getLocal: (key,cb) -> - try - out = JSON.parse window.localStorage.getItem key - cb null,out - catch e - cb e diff --git a/pub/work/src/js/stores/WorkStore.coffee b/pub/work/src/js/stores/WorkStore.coffee deleted file mode 100644 index df5c450f8b..0000000000 --- a/pub/work/src/js/stores/WorkStore.coffee +++ /dev/null @@ -1,153 +0,0 @@ -EventEmitter = require('events').EventEmitter -assign = require 'object-assign' -Dispatcher = require '../dispatcher/Dispatcher.coffee' -{uuid32} = require '../util.coffee' - -_tasks = {} -_list = [] -_listening = [] -_updated = Date.now() -_filters = - done:null - creator:null - doer:null - audience:null - tags:null -_sorts = - sort:0 - title:0 - creator:0 - date_due:0 -_ghost = id:uuid32() - -WorkStore = assign {},EventEmitter.prototype,{ - emitChange: -> @emit 'change' - addChangeListener: (cb) -> @on 'change', cb - removeChangeListener: (cb) -> @removeListener "change", cb - - getData: ({sort,tasks})-> - sort.map (id,index)=> - unless _tasks[id] - _list.splice index, 0, id - if !tasks[id] - console.log "lost", id - else if !_tasks[id] or tasks[id].version > _tasks[id].version - _tasks[id] = @itemFromData tasks[id], index - _updated = Date.now() - - getUpdated: -> _updated - - getFullList: -> _list - getList: (key) -> - list = [] - for id in _list - task = _tasks[id] - if !task? or task.archived - continue - add = true - for _k,_v of _filters - if _v is null then continue - c = task[_k] - add = switch _k - when 'tags', 'audience' - _.intersection(c,_v).length isnt 0 - when 'creator' - c is _v.replace(/\~/g, "") - when 'done' - !!c is _v - else c is _v - break unless add - if add - list.push task - if _.uniq(_.values(_sorts)).length > 1 - for k,v of _sorts - if v isnt 0 - break - list = _.sortBy list,k,k - if v is -1 then list.reverse() - unless @noNew() - ghost = $.extend {ghost:true,version:-1}, _ghost - if _filters.tags then ghost.tags = _filters.tags - if _filters.audience then ghost.audience = _filters.audience - list.push ghost - list - - newItem: ({before,after,item}) -> - if before - index = _list.indexOf before - if index is -1 then index = null - if after - index = 1 + _list.indexOf after - if index is 0 then index = null - - index ?= _list.length - - if item.id is _ghost.id - _ghost.id = uuid32() - unless _tasks[item.id]? - _list.splice index,0,item.id - else if _tasks[item.id].version >= 0 - throw new Error "Collision: already have #{item.id}" - _tasks[item.id] = @itemFromData item, index - - loadFilters: ({filters}) -> - console.log 'filters' - console.log filters - _filters = filters - getFilters: -> _filters - setFilter: ({key,val}) -> - _filters[key] = val - - loadSorts: ({sorts}) -> - console.log 'load sorts' - console.log sorts - _sorts = sorts - getSorts: -> _sorts - setSort: ({key,val}) -> - for k,v of _sorts - _sorts[k] = 0 - _sorts[key] = val - - canSort: -> - for k,v of _sorts - if k is "sort" and v is 1 - return true - else if v isnt 0 - return false - true - - noNew: -> - (_filters.done is true) or - _filters.creator? and _filters.owner isnt urb.ship - - itemFromData: (item,index=0)-> - _item = _.extend {sort:index}, item - _item.date_modified = new Date item.date_modified - _item.date_created = new Date item.date_created - _item.date_due = new Date item.date_due if item.date_due? - _item.done = new Date item.done if item.done? - _item.discussion = item.discussion.map ({ship,body,date}) -> - {ship,body,date: new Date date} - _item - - moveItems: ({list,to,from}) -> - _tasks[_list[from]].sort = _tasks[_list[to]].sort - _list = list - setAudience: ({id,to})-> _tasks[id].audience = to - archiveItem: ({id})-> _tasks[id].archived = true - updateItem: ({id,version,key,val})-> - _tasks[id].version = version - _tasks[id].done = val if key is 'done' - -} - -WorkStore.setMaxListeners 100 - -WorkStore.dispatchToken = Dispatcher.register (p) -> - a = p.action - - if WorkStore[a.type] - WorkStore[a.type] a - WorkStore.emitChange() - -module.exports = WorkStore diff --git a/pub/work/src/js/util.coffee b/pub/work/src/js/util.coffee deleted file mode 100644 index 9fb50242d0..0000000000 --- a/pub/work/src/js/util.coffee +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = - uuid32: -> - vals = for i in [0..5] - str = Math.ceil(Math.random()*10000000).toString(32) - ("00000"+str).substr(-5,5) - vals.unshift Math.ceil(Math.random()*8) - "0v" + vals.join '.' - - getScroll: -> - @writingPosition = $('#c').outerHeight(true)+$('#c').offset().top-$(window).height() - - setScroll: -> - window.util.getScroll() - $(window).scrollTop($("#c").height()) - - isScrolling: -> - if not window.util.writingPosition - window.util.getScroll() - return ($(window).scrollTop()+$('#writing').outerHeight() < window.util.writingPosition) - - checkScroll: -> - if window.util.isScrolling() - $('body').addClass 'scrolling' - else - $('body').removeClass 'scrolling' - talk: - mainStations: ["court","floor","porch"] - mainStationPath: (user) -> "~#{user}/#{window.util.talk.mainStation(user)}" - mainStation: (user) -> - if not user then user = window.urb.user - switch user.length - when 3 - return "court" - when 6 - return "floor" - when 13 - return "porch" - diff --git a/pub/work/test.work-task b/pub/work/test.work-task deleted file mode 100644 index fcf9438a30..0000000000 --- a/pub/work/test.work-task +++ /dev/null @@ -1,8 +0,0 @@ -0v0_~1999.1.1 2~1999.1.2 ~1999.5.20 - Tagged! -Yoooo -~fyr>~zod - Testin -~doznec ~2015.1.3 - how long has - this been around?