33 changed files with 934 additions and 1301 deletions
Split View
Diff Options
-
2bower.json
-
116customize.dist/about.html
-
113customize.dist/contact.html
-
235customize.dist/index.html
-
125customize.dist/main2.js
-
285customize.dist/pages.js
-
134customize.dist/privacy.html
-
85customize.dist/src/build.js
-
11customize.dist/src/fragments/about.html
-
2customize.dist/src/fragments/appscript.html
-
8customize.dist/src/fragments/contact.html
-
1customize.dist/src/fragments/empty.html
-
43customize.dist/src/fragments/footer.html
-
3customize.dist/src/fragments/fork.html
-
127customize.dist/src/fragments/index.html
-
3customize.dist/src/fragments/logo.html
-
14customize.dist/src/fragments/noscript.html
-
29customize.dist/src/fragments/privacy.html
-
1customize.dist/src/fragments/script.html
-
14customize.dist/src/fragments/table.html
-
12customize.dist/src/fragments/terms.html
-
30customize.dist/src/fragments/topbar.html
-
19customize.dist/src/template.html
-
117customize.dist/terms.html
-
2package.json
-
64www/common/LessLoader.js
-
12www/common/RequireLess.js
-
10www/common/boot2.js
-
398www/common/hyperscript.js
-
107www/settings/index.html
-
5www/settings/main.js
-
107www/user/index.html
-
1www/user/main.js
@ -0,0 +1,125 @@ |
|||
define([ |
|||
'jquery', |
|||
'/common/hyperscript.js', |
|||
'/common/cryptpad-common.js', |
|||
'/customize/pages.js', |
|||
|
|||
'css!/customize/main.css', |
|||
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', |
|||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', |
|||
], function ($, h, Cryptpad, Pages) { |
|||
$(function () { |
|||
var Messages = Cryptpad.Messages; |
|||
var $body = $('body'); |
|||
|
|||
var rightLink = function (ref, loc, txt) { |
|||
return h('span.link.right', [ |
|||
h('a', { href: ref, 'data-localization': loc}, txt) |
|||
]) |
|||
}; |
|||
|
|||
var $topbar = $(h('div#cryptpadTopBar', [ |
|||
h('span', [ |
|||
h('a.gotoMain', {href: '/'}, [ |
|||
h('img.cryptpad-logo', { |
|||
src: '/customize/cryptofist_mini.png', |
|||
alt: '', |
|||
}), |
|||
'CryptPad' |
|||
]) |
|||
]), |
|||
h('span#user-menu.right.dropdown-bar'), |
|||
h('span#language-selector.right.dropdown-bar'), |
|||
|
|||
rightLink('/about.html', 'about', 'About'), |
|||
rightLink('/privacy.html', 'privacy', 'Privacy'), |
|||
rightLink('/terms.html', 'terms', 'ToS'), |
|||
rightLink('/contact.html', 'contact', 'Contact'), |
|||
rightLink('https://blog.cryptpad.fr/', 'blog', 'Blog'), |
|||
h('span.link.right', [ |
|||
h('button#upgrade.upgrade.btn.buttonSuccess', { |
|||
style: { display: 'none' } |
|||
}) |
|||
]) |
|||
] |
|||
)) |
|||
|
|||
var $main = $(h('div#mainBlock.hidden', |
|||
typeof(Pages[location.pathname]) === 'function'? |
|||
Pages[location.pathname](): [h('div#container')] |
|||
)); |
|||
|
|||
var footerCol = function (title, L, literal) { |
|||
return h('div.col', [ |
|||
h('ul.list-unstyled', [ |
|||
h('li.title', { |
|||
'data-localization': title, |
|||
}, title? Messages[title]: literal ) |
|||
].concat(L.map(function (l) { |
|||
return h('li', [ l ]); |
|||
})) |
|||
) |
|||
]) |
|||
}; |
|||
|
|||
var footLink = function (ref, loc, text) { |
|||
var attrs = { |
|||
href: ref, |
|||
}; |
|||
if (!/^\//.test(ref)) { |
|||
attrs.target = '_blank'; |
|||
attrs.rel = 'noopener noreferrer'; |
|||
} |
|||
if (loc) { |
|||
attrs['data-localization'] = loc; |
|||
text = Messages[loc]; |
|||
} |
|||
return h('a', attrs, text); |
|||
}; |
|||
|
|||
var $footer = $(h('footer', [ |
|||
h('div.container', [ |
|||
h('div.row', [ |
|||
footerCol(null, [ |
|||
footLink('/about.html', 'about'), |
|||
footLink('/terms.html', 'terms'), |
|||
footLink('/privacy.html', 'privacy'), |
|||
], 'CryptPad'), |
|||
footerCol('footer_applications', [ |
|||
footLink('/drive/', 'main_drive'), |
|||
footLink('/pad/', 'main_richText'), |
|||
footLink('/code/', 'main_code'), |
|||
footLink('/slide/', 'main_slide'), |
|||
footLink('/poll/', 'main_poll'), |
|||
footLink('/whiteboard/', null, Messages.type.whiteboard) |
|||
]), |
|||
footerCol('footer_aboutUs', [ |
|||
footLink('https://blog.cryptpad.fr', 'blog'), |
|||
footLink('https://labs.xwiki.com', null, 'XWiki Labs'), |
|||
footLink('http://www.xwiki.com', null, 'XWiki SAS'), |
|||
footLink('https://www.open-paas.org', null, 'OpenPaaS') |
|||
]), |
|||
footerCol('footer_contact', [ |
|||
footLink('https://riot.im/app/#/room/#cryptpad:matrix.org', null, 'Chat'), |
|||
footLink('https://twitter.com/cryptpad', null, 'Twitter'), |
|||
footLink('https://github.com/xwiki-labs/cryptpad', null, 'GitHub'), |
|||
footLink('/contact.html', null, 'Email') |
|||
]) |
|||
]) |
|||
]), |
|||
h('div.version-footer', "CryptPad v1.10.0 (Kraken)") |
|||
])); |
|||
|
|||
$body.append($topbar).append($main).append($footer); |
|||
|
|||
if (/^\/settings\//.test(location.pathname)) { |
|||
require([ '/settings/main.js', ], function () {}); |
|||
} else if (/^\/user\//.test(location.pathname)) { |
|||
// do nothing. bogus app.
|
|||
require([ '/user/main.js'], function () {}); |
|||
} else { |
|||
setTimeout(function () { |
|||
require([ '/customize/main.js', ], function () {}); |
|||
}); |
|||
} |
|||
})}); |
|||
@ -0,0 +1,285 @@ |
|||
define([ |
|||
'/common/hyperscript.js', |
|||
'/common/cryptpad-common.js', |
|||
], function (h, Cryptpad) { |
|||
var Pages = {}; |
|||
var Msg = Cryptpad.Messages; |
|||
|
|||
Pages['/about.html'] = function () { |
|||
var p2 = h('p'); |
|||
p2.innerHTML = Msg.main_p2; |
|||
|
|||
var hiw = h('p'); |
|||
hiw.innerHTML = Msg.main_howitworks_p1; |
|||
return h('div#main_other', [ |
|||
h('center', [ |
|||
h('h1', Msg.about) |
|||
]), |
|||
p2, |
|||
h('h2', Msg.main_howitworks), |
|||
hiw |
|||
]); |
|||
}; |
|||
|
|||
Pages['/privacy.html'] = function () { |
|||
var vpn = h('p'); |
|||
vpn.innerHTML = Msg.policy_choices_vpn; |
|||
return h('div#main_other', [ |
|||
h('center', h('h1', Msg.policy_title)), |
|||
h('h2', Msg.policy_whatweknow), |
|||
h('p', Msg.policywhatweknow_p1), |
|||
|
|||
h('h2', Msg.policy_howweuse), |
|||
h('p', Msg.policy_howweuse_p1), |
|||
h('p', Msg.policy_howweuse_p2), |
|||
|
|||
h('h2', Msg.policy_whatwetell), |
|||
h('p', Msg.policy_whatwetell_p1), |
|||
|
|||
h('h2', Msg.policy_links), |
|||
h('p', Msg.policy_links_p1), |
|||
|
|||
h('h2', Msg.policy_ads), |
|||
h('p', Msg.policy_ads_p1), |
|||
|
|||
h('h2', Msg.policy_choices), |
|||
h('p', Msg.policy_choices_open), |
|||
vpn, |
|||
|
|||
h('br') |
|||
]); |
|||
}; |
|||
|
|||
Pages['/terms.html'] = function () { |
|||
return h('div#main_other', [ |
|||
h('center', h('h1', Msg.tos_title)), |
|||
h('p', Msg.tos_legal), |
|||
h('p', Msg.tos_availability), |
|||
h('p', Msg.tos_e2ee), |
|||
h('p', Msg.tos_logs), |
|||
h('p', Msg.tos_3rdparties), |
|||
]); |
|||
}; |
|||
|
|||
Pages['/contact.html'] = function () { |
|||
var about = h('p'); |
|||
about.innerHTML = Msg.main_about_p2; |
|||
return h('div#main_other', [ |
|||
h('center', h('h1', Msg.contact)), |
|||
about |
|||
]) |
|||
}; |
|||
|
|||
var userForm = function () { |
|||
return h('div#userForm.form-group.hidden', [ |
|||
h('input#name.form-control', { |
|||
name: 'name', |
|||
type: 'text', |
|||
placeholder: Msg.login_username |
|||
}), |
|||
h('input#password.form-control', { |
|||
name: 'password', |
|||
type: 'password', |
|||
placeholder: Msg.login_password |
|||
}), |
|||
h('div', { |
|||
style: { display: 'none' } |
|||
}, [ |
|||
h('span.remember.form-check', [ |
|||
h('label.form-check-label', { |
|||
'for': 'rememberme', |
|||
placeholder: Msg.login_remember, |
|||
}, [ |
|||
h('input#rememberme.form-check-input', { |
|||
type: 'checkbox', |
|||
checked: true |
|||
}) |
|||
]) |
|||
]) |
|||
]), |
|||
h('button.btn.btn-secondary.login.half.first', Msg.login_login), |
|||
h('button.btn.btn-success.register.half.first', Msg.login_register), |
|||
h('p.separator', Msg.login_orNoLogin), |
|||
h('p#buttons.buttons'), |
|||
h('p.driveLink', [ |
|||
h('a.gotodrive', { |
|||
href: '/drive/' |
|||
}, Msg.login_nologin) |
|||
]) |
|||
]); |
|||
}; |
|||
|
|||
var indexContent = function () { |
|||
var mainZK = h('p'); |
|||
mainZK.innerHTML = Msg.main_zeroKnowledge_p; |
|||
return [ |
|||
h('div.page.category.first#knowmore', [ |
|||
h('center', [ |
|||
h('h1', Msg.main_howitworks) |
|||
]) |
|||
]), |
|||
h('div.page', [ |
|||
h('div.info-container', [ |
|||
h('div.left.image', [ |
|||
h('img', { |
|||
src: '/customize/images/zeroknowledge_small.png', |
|||
alt: 'Zero Knowledge' |
|||
}) |
|||
]), |
|||
h('div.right', [ |
|||
h('h2', Msg.main_zeroKnowledge), |
|||
mainZK |
|||
]) |
|||
]) |
|||
]), |
|||
h('div.page.even', [ |
|||
h('div.info-container', [ |
|||
h('div.left', [ |
|||
h('h2', Msg.main_writeItDown), |
|||
h('p', Msg.main_writeItDown_p) |
|||
]), |
|||
h('div.right.image', [ |
|||
h('img', { |
|||
alt: "User account", |
|||
src: '/customize/images/realtime_small.png', |
|||
}) |
|||
]) |
|||
]) |
|||
]), |
|||
h('div.page', [ |
|||
h('div.info-container', [ |
|||
h('div.left.image', [ |
|||
h('img', { |
|||
src: '/customize/images/key_small.png', |
|||
alt: 'User account' |
|||
}) |
|||
]), |
|||
h('div.right', [ |
|||
h('h2', Msg.main_share), |
|||
h('p', Msg.main_share_p) |
|||
]) |
|||
]) |
|||
]), |
|||
h('div.page.even', [ |
|||
h('div.info-container', [ |
|||
h('div.left', [ |
|||
h('h2', Msg.main_organize), |
|||
h('p', Msg.main_organize_p) |
|||
]), |
|||
h('div.right.image', [ |
|||
h('img', { |
|||
src: '/customize/images/organize.png', |
|||
alt: 'User account' |
|||
}) |
|||
]) |
|||
]) |
|||
]) |
|||
]; |
|||
}; |
|||
|
|||
var appButton = function (alt, h2, img, p, url, btn, id) { |
|||
var P = h('p'); |
|||
P.innerHTML = p; |
|||
|
|||
return h('div.app', [ |
|||
h('center', [ |
|||
h('h2', h2), |
|||
h('img', { |
|||
alt: 'Rich Text application', |
|||
src: img, |
|||
}) |
|||
]), |
|||
P, |
|||
h('p.buttons', [ |
|||
h('a#' + id, { |
|||
href: url, |
|||
}, [ |
|||
h('button.btn.btn-secondary', btn), |
|||
]) |
|||
]) |
|||
]); |
|||
}; |
|||
|
|||
var tryIt = function () { |
|||
return [ |
|||
h('div.class.category#tryit', [ |
|||
h('center', [ |
|||
h('h1', Msg.tryIt) |
|||
]) |
|||
]), |
|||
h('div.page', [ |
|||
h('div.app-container', [ |
|||
h('div.app-row', [ |
|||
appButton("Rich Text application", |
|||
Msg.main_richText, |
|||
'/customize/images/pad.png', |
|||
Msg.main_richText_p, |
|||
'/pad/', |
|||
Msg.button_newpad, |
|||
'create-pad'), |
|||
appButton('Code application', |
|||
Msg.main_code, |
|||
'/customize/images/code.png', |
|||
Msg.main_code_p, |
|||
'/code/', |
|||
Msg.button_newcode, |
|||
'create-code'), |
|||
appButton('Slide application', |
|||
Msg.main_slide, |
|||
'/customize/images/slide.png', |
|||
Msg.main_slide_p, |
|||
'/slide/', |
|||
Msg.button_newslide, |
|||
'create-slide'), |
|||
appButton('Poll application', |
|||
Msg.main_poll, |
|||
'/customize/images/poll.png', |
|||
Msg.main_poll_p, |
|||
'/poll/', |
|||
Msg.button_newpoll, |
|||
'create-poll') |
|||
]) |
|||
]) |
|||
]) |
|||
] |
|||
}; |
|||
|
|||
Pages['/'] = Pages['/index.html'] = function () { |
|||
var slogan = h('p.left'); |
|||
slogan.innerHTML = Msg.main_info; |
|||
return [ |
|||
h('div#main', [ |
|||
h('div.mainOverlay'), |
|||
h('div#align-container', [ |
|||
h('div#main-container', [ |
|||
h('div#data.hidden', [ |
|||
slogan |
|||
]), |
|||
userForm(), |
|||
h('div#loggedIn.hidden', [ |
|||
h('p#loggedInHello'), |
|||
h('p', [ |
|||
h('button.btn.btn-primary.gotodrive', Msg.login_accessDrive), |
|||
]), |
|||
h('p', [ |
|||
h('button#loggedInLogout.btn.btn-secondary', Msg.logoutButton) |
|||
]) |
|||
]) |
|||
]) |
|||
]), |
|||
]) |
|||
] |
|||
.concat(indexContent()) |
|||
.concat(tryIt()); |
|||
}; |
|||
|
|||
Pages['/settings/'] = Pages['/settings/index.html'] = function () { |
|||
return h('div#container'); |
|||
}; |
|||
|
|||
Pages['/user/'] = Pages['/user/index.html'] = function () { |
|||
return h('div#container'); |
|||
}; |
|||
|
|||
return Pages; |
|||
}); |
|||
@ -1,85 +0,0 @@ |
|||
var Fs = require("fs"); |
|||
|
|||
// read a file
|
|||
var read = function (path) { |
|||
return Fs.readFileSync(path, 'utf-8'); |
|||
}; |
|||
|
|||
// write a file
|
|||
var write = function (path, src) { |
|||
return Fs.writeFileSync(path, src); |
|||
}; |
|||
|
|||
// basic templating
|
|||
var swap = function (src, dict) { |
|||
return src.replace(/\{\{(.*?)\}\}/g, function (a, b) { |
|||
return dict[b] || b; |
|||
}); |
|||
}; |
|||
|
|||
// read the template file
|
|||
var template = read('./template.html'); |
|||
|
|||
// read page fragments
|
|||
var fragments = {}; |
|||
[ 'index', |
|||
'fork', |
|||
'topbar', |
|||
'terms', |
|||
'privacy', |
|||
'about', |
|||
'contact', |
|||
'logo', |
|||
'noscript', |
|||
'footer', |
|||
'empty', |
|||
'script', |
|||
'appscript' |
|||
].forEach(function (name) { |
|||
fragments[name] = read('./fragments/' + name + '.html'); |
|||
}); |
|||
|
|||
// build static pages
|
|||
['index', 'privacy', 'terms', 'about', 'contact'].forEach(function (page) { |
|||
var source = swap(template, { |
|||
topbar: fragments.topbar, |
|||
fork: fragments.fork, |
|||
main: swap(fragments[page] || fragments.empty, { |
|||
topbar: fragments.topbar, |
|||
fork: fragments.fork, |
|||
logo: fragments.logo, |
|||
noscript: fragments.noscript, |
|||
footer: fragments.footer, |
|||
}), |
|||
logo: fragments.logo, |
|||
noscript: fragments.noscript, |
|||
footer: fragments.footer, |
|||
script: fragments.script |
|||
}); |
|||
write('../' + page + '.html', source); |
|||
}); |
|||
|
|||
// build static pages
|
|||
[ |
|||
'../www/settings/index', |
|||
'../www/user/index' |
|||
].forEach(function (page) { |
|||
var source = swap(template, { |
|||
topbar: fragments.topbar, |
|||
fork: fragments.fork, |
|||
main: swap(fragments[page] || fragments.empty, { |
|||
topbar: fragments.topbar, |
|||
fork: fragments.fork, |
|||
logo: fragments.logo, |
|||
noscript: fragments.noscript, |
|||
footer: fragments.footer, |
|||
}), |
|||
logo: fragments.logo, |
|||
noscript: fragments.noscript, |
|||
footer: fragments.footer, |
|||
script: fragments.appscript |
|||
}); |
|||
write('../' + page + '.html', source); |
|||
}); |
|||
|
|||
|
|||
@ -1,11 +0,0 @@ |
|||
<div id="main_other"> |
|||
<center> |
|||
<h1 data-localization="about">About</h1> |
|||
</center> |
|||
|
|||
<p data-localization="main_p2"><!-- CkEditor, CodeMirror, Chainpad --></p> |
|||
|
|||
<h2 id="howitworks" data-localization="main_howitworks"></h2> |
|||
<p data-localization="main_howitworks_p1"><!-- Operational transform, Nakamoto blockchain, server kept unaware of the content--></p> |
|||
</div> |
|||
|
|||
@ -1,2 +0,0 @@ |
|||
<link rel="stylesheet" type="text/css" href="main.css" /> |
|||
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> |
|||
@ -1,8 +0,0 @@ |
|||
<div id="main_other"> |
|||
<center> |
|||
<h1 data-localization="contact">Contact</h1> |
|||
</center> |
|||
|
|||
<p data-localization="main_about_p2"><!-- Contact us--></p> |
|||
</div> |
|||
|
|||
@ -1 +0,0 @@ |
|||
<div id="container"></div> |
|||
@ -1,43 +0,0 @@ |
|||
<footer> |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<ul class="list-unstyled"> |
|||
<li class="title">CryptPad</li> |
|||
<li><a href="/about.html" data-localization="about"></a></li> |
|||
<li><a href="/terms.html" data-localization="terms"></a></li> |
|||
<li><a href="/privacy.html" data-localization="privacy"></a></li> |
|||
</ul> |
|||
</div> |
|||
<div class="col"> |
|||
<ul class="list-unstyled"> |
|||
<li class="title" data-localization="footer_applications"><li> |
|||
<li><a href="/pad/" data-localization="main_richText"></a></li> |
|||
<li><a href="/code/" data-localization="main_code"></a></li> |
|||
<li><a href="/slide/" data-localization="main_slide"></a></li> |
|||
<li><a href="/poll/" data-localization="main_poll"></a></li> |
|||
<li><a href="/drive/" data-localization="main_drive"></a></li> |
|||
</ul> |
|||
</div> |
|||
<div class="col"> |
|||
<ul class="list-unstyled"> |
|||
<li class="title" data-localization="footer_aboutUs"><li> |
|||
<li><a href="https://blog.cryptpad.fr" target="_blank" data-localization="blog" rel="noopener noreferrer">Blog</a></li> |
|||
<li><a href="https://labs.xwiki.com" target="_blank" rel="noopener noreferrer">XWiki Labs</a></li> |
|||
<li><a href="http://www.xwiki.com" target="_blank" rel="noopener noreferrer">XWiki SAS</a></li> |
|||
<li><a href="https://www.open-paas.org/" target="_blank" rel="noopener noreferrer">OpenPaaS</a></li> |
|||
</ul> |
|||
</div> |
|||
<div class="col"> |
|||
<ul class="list-unstyled"> |
|||
<li class="title" data-localization="footer_contact"><li> |
|||
<li><a href="https://riot.im/app/#/room/#cryptpad:matrix.org" target="_blank" rel="noopener noreferrer">Chat</a></li> |
|||
<li><a href="https://twitter.com/cryptpad" target="_blank" rel="noopener noreferrer">Twitter</a></li> |
|||
<li><a href="https://github.com/xwiki-labs/cryptpad" target="_blank" rel="noopener noreferrer">GitHub</a></li> |
|||
<li><a href="/contact.html">Email</a></li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="version-footer">CryptPad v1.9.0 (Jackelope)</div> |
|||
</footer> |
|||
@ -1,3 +0,0 @@ |
|||
<a data-localization-title="github_ribbon" href="https://github.com/xwiki-labs/cryptpad" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="position: absolute; top: 50px; border: 0; left: 0; transform: scale(-1, 1);z-index:2;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style> |
|||
<!-- Thanks! http://tholman.com/github-corners/ --> |
|||
|
|||
@ -1,127 +0,0 @@ |
|||
{{fork}} |
|||
|
|||
<div id="main"> |
|||
<div class="mainOverlay"></div> |
|||
<div id="align-container"> |
|||
<div id="main-container"> |
|||
<div id="data" class="hidden"> |
|||
<p class="left" data-localization="main_info"><!-- Collaborate in Confidence. --></p> |
|||
</div> |
|||
|
|||
<div id="userForm" class="form-group hidden"> |
|||
<input type="text" id="name" name="name" class="form-control" data-localization-placeholder="login_username"> |
|||
<input type="password" id="password" name="password" class="form-control" data-localization-placeholder="login_password"> |
|||
<div style="display: none;"><span class="remember form-check"><label for="rememberme" class="form-check-label" data-localization-append="login_remember"><input type="checkbox" id="rememberme" class="form-check-input" checked="checked"></label></span><br></div> |
|||
<button class="btn btn-secondary login half first" data-localization="login_login"></button> <button class="btn btn-success register half" data-localization="login_register"></button> |
|||
<p class="separator" data-localization="login_orNoLogin"></p> |
|||
<p id="buttons" class="buttons"></p> |
|||
<p class="driveLink"><a class="gotodrive" href="/drive/" data-localization="login_nologin"></a></p> |
|||
</div> |
|||
<div id="loggedIn" class="hidden"> |
|||
<p id="loggedInHello"></p> |
|||
<p><button class="btn btn-primary gotodrive" data-localization="login_accessDrive"></button></p> |
|||
<p><button id="loggedInLogOut" class="btn btn-secondary" data-localization="logoutButton"></button></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="page category first" id="knowmore"> |
|||
<center> |
|||
<h1 data-localization="main_howitworks"></h1> |
|||
</center> |
|||
</div> |
|||
<div class="page"> |
|||
<div class="info-container"> |
|||
<div class="left image"> |
|||
<img src="customize/images/zeroknowledge_small.png" alt="Zero Knowledge" /> |
|||
</div> |
|||
<div class="right"> |
|||
<h2 data-localization="main_zeroKnowledge"></h2> |
|||
<p data-localization="main_zeroKnowledge_p"></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="page even"> |
|||
<div class="info-container"> |
|||
<div class="left"> |
|||
<h2 data-localization="main_writeItDown"></h2> |
|||
<p data-localization="main_writeItDown_p"></p> |
|||
</div> |
|||
<div class="right image"> |
|||
<img src="customize/images/realtime_small.png" alt="User account" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="page"> |
|||
<div class="info-container"> |
|||
<div class="left image"> |
|||
<img src="customize/images/key_small.png" alt="User account" /> |
|||
</div> |
|||
<div class="right"> |
|||
<h2 data-localization="main_share"></h2> |
|||
<p data-localization="main_share_p"></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="page even"> |
|||
<div class="info-container"> |
|||
<div class="left"> |
|||
<h2 data-localization="main_organize"></h2> |
|||
<p data-localization="main_organize_p"></p> |
|||
</div> |
|||
<div class="right image"> |
|||
<img src="customize/images/organize.png" alt="User account" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="page category" id="tryit"> |
|||
<center> |
|||
<h1 data-localization="tryIt">Try it out!</h1> |
|||
</center> |
|||
</div> |
|||
<div class="page"> |
|||
<div class="app-container"> |
|||
<div class="app-row"> |
|||
<div class="app"> |
|||
<center> |
|||
<h2 data-localization="main_richText"></h2> |
|||
<img src="customize/images/pad.png" alt="Rich Text application" /> |
|||
</center> |
|||
<p data-localization="main_richText_p"></p> |
|||
<p class="buttons"> |
|||
<a id="create-pad" href="/pad/"><button class="btn btn-secondary" data-localization="button_newpad"></button></a> |
|||
</p> |
|||
</div><div class="app"> |
|||
<center> |
|||
<h2 data-localization="main_code"></h2> |
|||
<img src="customize/images/code.png" alt="Code application" /> |
|||
</center> |
|||
<p data-localization="main_code_p"></p> |
|||
<p class="buttons"> |
|||
<a id="create-code" href="/code/"><button class="btn btn-secondary" data-localization="button_newcode"></button></a> |
|||
</p> |
|||
</div><!-- |
|||
--></div><!-- |
|||
--><div class="app-row"><!-- |
|||
--><div class="app"> |
|||
<center> |
|||
<h2 data-localization="main_slide"></h2> |
|||
<img src="customize/images/slide.png" alt="Slide applcation" /> |
|||
</center> |
|||
<p data-localization="main_slide_p"></p> |
|||
<p class="buttons"> |
|||
<a id="create-slide" href="/slide/"><button class="btn btn-secondary" data-localization="button_newslide"></button></a> |
|||
</p> |
|||
</div><div class="app"> |
|||
<center> |
|||
<h2 data-localization="main_poll"></h2> |
|||
<img src="customize/images/poll.png" alt="Poll application" /> |
|||
</center> |
|||
<p data-localization="main_poll_p"></p> |
|||
<p class="buttons"> |
|||
<a id="create-poll" href="/poll/"><button class="btn btn-secondary" data-localization="button_newpoll"></button></a> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,3 +0,0 @@ |
|||
<center> |
|||
<a href="/"><img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" /></a> |
|||
</center> |
|||
@ -1,14 +0,0 @@ |
|||
<noscript> |
|||
<div id="noscriptContainer"> |
|||
<div class="mainOverlay"></div> |
|||
<div id="noscript"> |
|||
<p> |
|||
<strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required. |
|||
</p> |
|||
<hr> |
|||
<p> |
|||
<strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</noscript> |
|||
@ -1,29 +0,0 @@ |
|||
<div id="main_other"> |
|||
<center> |
|||
<h1 data-localization="policy_title"></h1> |
|||
</center> |
|||
|
|||
<h2 data-localization="policy_whatweknow"></h2> |
|||
<p data-localization="policy_whatweknow_p1"><!-- HTTP headers, IP address--></p> |
|||
|
|||
<h2 data-localization="policy_howweuse"></h2> |
|||
<p data-localization="policy_howweuse_p1"><!-- Referrer : promoting--></p> |
|||
<p data-localization="policy_howweuse_p2"><!-- Browser : prioritizing new features--></p> |
|||
|
|||
<h2 data-localization="policy_whatwetell"></h2> |
|||
<p data-localization="policy_whatwetell_p1"></p> |
|||
|
|||
<h2 data-localization="policy_links"></h2> |
|||
<p data-localization="policy_links_p1"></p> |
|||
|
|||
<h2 data-localization="policy_ads"></h2> |
|||
<p data-localization="policy_ads_p1"></p> |
|||
|
|||
<h2 data-localization="policy_choices"></h2> |
|||
<p data-localization="policy_choices_open"></p> |
|||
<p data-localization="policy_choices_vpn"></p> |
|||
|
|||
<br /> |
|||
</div> |
|||
|
|||
|
|||
@ -1 +0,0 @@ |
|||
<script data-bootload="/customize/main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> |
|||
@ -1,14 +0,0 @@ |
|||
<!--<table class="recent scroll" style="display:none"> |
|||
<tbody> |
|||
|
|||
<tr> |
|||
<th data-localization="table_type"></th> |
|||
<th data-localization="table_link"></th> |
|||
<th data-localization="table_created"></th> |
|||
<th data-localization="table_last"></th> |
|||
<th></th> |
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table>--> |
|||
|
|||
@ -1,12 +0,0 @@ |
|||
<div id="main_other"> |
|||
<center> |
|||
<h1 data-localization="tos_title"></h1> |
|||
</center> |
|||
|
|||
<p data-localization="tos_legal"></p> |
|||
<p data-localization="tos_availability"></p> |
|||
<p data-localization="tos_e2ee"></p> |
|||
<p data-localization="tos_logs"></p> |
|||
<p data-localization="tos_3rdparties"></p> |
|||
</div> |
|||
|
|||
@ -1,30 +0,0 @@ |
|||
<div id="cryptpadTopBar"> |
|||
<span> |
|||
<a class="gotoMain" href="/"> |
|||
<img src="/customize/cryptofist_mini.png" class="cryptpad-logo" alt="" /> CryptPad |
|||
</a> |
|||
</span> |
|||
|
|||
<!--<span class="slogan" data-localization="main_slogan"></span>--> |
|||
|
|||
<span id="user-menu" class="right dropdown-bar"></span> |
|||
<span id="language-selector" class="right dropdown-bar"></span> |
|||
<span class="link right"> |
|||
<a href="/about.html" data-localization="about">About</a> |
|||
</span> |
|||
<span class="link right"> |
|||
<a href="/privacy.html" data-localization="privacy">Privacy</a> |
|||
</span> |
|||
<span class="link right"> |
|||
<a href="/terms.html" data-localization="terms">ToS</a> |
|||
</span> |
|||
<span class="link right"> |
|||
<a href="/contact.html" data-localization="contact">Contact</a> |
|||
</span> |
|||
<span class="link right"> |
|||
<a href="https://blog.cryptpad.fr/" data-localization="blog">Blog</a> |
|||
</span> |
|||
<span class="link right"> |
|||
<button id="upgrade" class="upgrade btn buttonSuccess" style="display: none;"></button> |
|||
</span> |
|||
</div> |
|||
@ -0,0 +1,64 @@ |
|||
/*@flow*/ |
|||
/*:: const define = () => {}; */ |
|||
define([ |
|||
'/api/config', |
|||
'/bower_components/less/dist/less.js' |
|||
], function (Config, Less) { /*::});module.exports = (function() { |
|||
const Config = (undefined:any); |
|||
const Less = (undefined:any); |
|||
*/ |
|||
|
|||
var module = { exports: {} }; |
|||
var key = Config.requireConf.urlArgs; |
|||
var localStorage = window.localStorage || {}; |
|||
|
|||
var fixURL = function (url) { |
|||
var mark = (url.indexOf('?') !== -1) ? '&' : '?'; |
|||
return url + mark + key; |
|||
}; |
|||
|
|||
var doXHR = Less.FileManager.prototype.doXHR; |
|||
Less.FileManager.prototype.doXHR = function (url, type, callback, errback) { |
|||
url = fixURL(url); |
|||
//console.log("xhr: " + url);
|
|||
return doXHR(url, type, callback, errback); |
|||
}; |
|||
|
|||
var inject = function (cssText, url) { |
|||
var curStyle = document.createElement('style'); |
|||
curStyle.setAttribute('data-original-src', url); |
|||
curStyle.type = 'text/css'; |
|||
curStyle.appendChild(document.createTextNode(cssText)); |
|||
if (!document.head) { throw new Error(); } |
|||
document.head.appendChild(curStyle); |
|||
}; |
|||
|
|||
var checkCache = function () { |
|||
if (localStorage['LESS_CACHE'] === key) { return; } |
|||
Object.keys(localStorage).forEach(function (k) { |
|||
if (k.indexOf('LESS_CACHE|') !== 0) { return; } |
|||
delete localStorage[k]; |
|||
}); |
|||
localStorage['LESS_CACHE'] = key; |
|||
}; |
|||
|
|||
var load = module.exports.load = function (url /*:string*/, cb /*:()=>void*/) { |
|||
checkCache(); |
|||
if (localStorage['LESS_CACHE|' + key + '|' + url]) { |
|||
inject(localStorage['LESS_CACHE|' + key + '|' + url], url); |
|||
cb(); |
|||
return; |
|||
} |
|||
Less.render('@import (multiple) "' + url + '";', {}, function(err, css) { |
|||
if (err) { |
|||
console.log(err); |
|||
return; |
|||
} |
|||
localStorage['LESS_CACHE|' + key + '|' + url] = css.css; |
|||
inject(css.css, url); |
|||
cb(); |
|||
}, window.less); |
|||
}; |
|||
|
|||
return module.exports; |
|||
})/*::()*/; |
|||
@ -0,0 +1,12 @@ |
|||
define([ |
|||
'/common/LessLoader.js' |
|||
], function (LessLoader) { |
|||
var api = {}; |
|||
api.normalize = function(name, normalize) { |
|||
return normalize(name); |
|||
}; |
|||
api.load = function(cssId, req, load, config) { |
|||
LessLoader.load(cssId, load); |
|||
}; |
|||
return api; |
|||
}); |
|||
@ -0,0 +1,398 @@ |
|||
define([], function () { |
|||
var Hyperscript; |
|||
|
|||
(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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
|||
var split = require('browser-split') |
|||
var ClassList = require('class-list') |
|||
require('html-element') |
|||
|
|||
function context () { |
|||
|
|||
var cleanupFuncs = [] |
|||
|
|||
function h() { |
|||
var args = [].slice.call(arguments), e = null |
|||
function item (l) { |
|||
var r |
|||
function parseClass (string) { |
|||
// Our minimal parser doesn’t understand escaping CSS special
|
|||
// characters like `#`. Don’t use them. More reading:
|
|||
// https://mathiasbynens.be/notes/css-escapes .
|
|||
|
|||
var m = split(string, /([\.#]?[^\s#.]+)/) |
|||
if(/^\.|#/.test(m[1])) |
|||
e = document.createElement('div') |
|||
forEach(m, function (v) { |
|||
var s = v.substring(1,v.length) |
|||
if(!v) return |
|||
if(!e) |
|||
e = document.createElement(v) |
|||
else if (v[0] === '.') |
|||
ClassList(e).add(s) |
|||
else if (v[0] === '#') |
|||
e.setAttribute('id', s) |
|||
}) |
|||
} |
|||
|
|||
if(l == null) |
|||
; |
|||
else if('string' === typeof l) { |
|||
if(!e) |
|||
parseClass(l) |
|||
else |
|||
e.appendChild(r = document.createTextNode(l)) |
|||
} |
|||
else if('number' === typeof l |
|||
|| 'boolean' === typeof l |
|||
|| l instanceof Date |
|||
|| l instanceof RegExp ) { |
|||
e.appendChild(r = document.createTextNode(l.toString())) |
|||
} |
|||
//there might be a better way to handle this...
|
|||
else if (isArray(l)) |
|||
forEach(l, item) |
|||
else if(isNode(l)) |
|||
e.appendChild(r = l) |
|||
else if(l instanceof Text) |
|||
e.appendChild(r = l) |
|||
else if ('object' === typeof l) { |
|||
for (var k in l) { |
|||
if (!l.hasOwnProperty(k)) { return; } |
|||
if('function' === typeof l[k]) { |
|||
if(/^on\w+/.test(k)) { |
|||
(function (k, l) { // capture k, l in the closure
|
|||
if (e.addEventListener){ |
|||
e.addEventListener(k.substring(2), l[k], false) |
|||
cleanupFuncs.push(function(){ |
|||
e.removeEventListener(k.substring(2), l[k], false) |
|||
}) |
|||
}else{ |
|||
e.attachEvent(k, l[k]) |
|||
cleanupFuncs.push(function(){ |
|||
e.detachEvent(k, l[k]) |
|||
}) |
|||
} |
|||
})(k, l) |
|||
} else { |
|||
// observable
|
|||
e[k] = l[k]() |
|||
cleanupFuncs.push(l[k](function (v) { |
|||
e[k] = v |
|||
})) |
|||
} |
|||
} |
|||
else if(k === 'style') { |
|||
if('string' === typeof l[k]) { |
|||
e.style.cssText = l[k] |
|||
}else{ |
|||
for (var s in l[k]) (function(s, v) { |
|||
if('function' === typeof v) { |
|||
// observable
|
|||
e.style.setProperty(s, v()) |
|||
cleanupFuncs.push(v(function (val) { |
|||
e.style.setProperty(s, val) |
|||
})) |
|||
} else |
|||
e.style.setProperty(s, l[k][s]) |
|||
})(s, l[k][s]) |
|||
} |
|||
} else if (k.substr(0, 5) === "data-") { |
|||
e.setAttribute(k, l[k]) |
|||
} else { |
|||
e[k] = l[k] |
|||
} |
|||
} |
|||
} else if ('function' === typeof l) { |
|||
//assume it's an observable!
|
|||
var v = l() |
|||
e.appendChild(r = isNode(v) ? v : document.createTextNode(v)) |
|||
|
|||
cleanupFuncs.push(l(function (v) { |
|||
if(isNode(v) && r.parentElement) |
|||
r.parentElement.replaceChild(v, r), r = v |
|||
else |
|||
r.textContent = v |
|||
})) |
|||
} |
|||
|
|||
return r |
|||
} |
|||
while(args.length) |
|||
item(args.shift()) |
|||
|
|||
return e |
|||
} |
|||
|
|||
h.cleanup = function () { |
|||
for (var i = 0; i < cleanupFuncs.length; i++){ |
|||
cleanupFuncs[i]() |
|||
} |
|||
cleanupFuncs.length = 0 |
|||
} |
|||
|
|||
return h |
|||
} |
|||
|
|||
var h = module.exports = context() |
|||
h.context = context |
|||
|
|||
Hyperscript = h; |
|||
|
|||
function isNode (el) { |
|||
return el && el.nodeName && el.nodeType |
|||
} |
|||
|
|||
function forEach (arr, fn) { |
|||
if (arr.forEach) return arr.forEach(fn) |
|||
for (var i = 0; i < arr.length; i++) fn(arr[i], i) |
|||
} |
|||
|
|||
function isArray (arr) { |
|||
return Object.prototype.toString.call(arr) == '[object Array]' |
|||
} |
|||
|
|||
},{"browser-split":2,"class-list":3,"html-element":6}],2:[function(require,module,exports){ |
|||
/*! |
|||
* Cross-Browser Split 1.1.1 |
|||
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com> |
|||
* Available under the MIT License |
|||
* ECMAScript compliant, uniform cross-browser split method |
|||
*/ |
|||
|
|||
/** |
|||
* Splits a string into an array of strings using a regex or string separator. Matches of the |
|||
* separator are not included in the result array. However, if `separator` is a regex that contains |
|||
* capturing groups, backreferences are spliced into the result each time `separator` is matched. |
|||
* Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably |
|||
* cross-browser. |
|||
* @param {String} str String to split. |
|||
* @param {RegExp|String} separator Regex or string to use for separating the string. |
|||
* @param {Number} [limit] Maximum number of items to include in the result array. |
|||
* @returns {Array} Array of substrings. |
|||
* @example |
|||
* |
|||
* // Basic use
|
|||
* split('a b c d', ' '); |
|||
* // -> ['a', 'b', 'c', 'd']
|
|||
* |
|||
* // With limit
|
|||
* split('a b c d', ' ', 2); |
|||
* // -> ['a', 'b']
|
|||
* |
|||
* // Backreferences in result array
|
|||
* split('..word1 word2..', /([a-z]+)(\d+)/i); |
|||
* // -> ['..', 'word', '1', ' ', 'word', '2', '..']
|
|||
*/ |
|||
module.exports = (function split(undef) { |
|||
|
|||
var nativeSplit = String.prototype.split, |
|||
compliantExecNpcg = /()??/.exec("")[1] === undef, |
|||
// NPCG: nonparticipating capturing group
|
|||
self; |
|||
|
|||
self = function(str, separator, limit) { |
|||
// If `separator` is not a regex, use `nativeSplit`
|
|||
if (Object.prototype.toString.call(separator) !== "[object RegExp]") { |
|||
return nativeSplit.call(str, separator, limit); |
|||
} |
|||
var output = [], |
|||
flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
|
|||
(separator.sticky ? "y" : ""), |
|||
// Firefox 3+
|
|||
lastLastIndex = 0, |
|||
// Make `global` and avoid `lastIndex` issues by working with a copy
|
|||
separator = new RegExp(separator.source, flags + "g"), |
|||
separator2, match, lastIndex, lastLength; |
|||
str += ""; // Type-convert
|
|||
if (!compliantExecNpcg) { |
|||
// Doesn't need flags gy, but they don't hurt
|
|||
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); |
|||
} |
|||
/* Values for `limit`, per the spec: |
|||
* If undefined: 4294967295 // Math.pow(2, 32) - 1
|
|||
* If 0, Infinity, or NaN: 0 |
|||
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; |
|||
* If negative number: 4294967296 - Math.floor(Math.abs(limit)) |
|||
* If other: Type-convert, then use the above rules |
|||
*/ |
|||
limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1
|
|||
limit >>> 0; // ToUint32(limit)
|
|||
while (match = separator.exec(str)) { |
|||
// `separator.lastIndex` is not reliable cross-browser
|
|||
lastIndex = match.index + match[0].length; |
|||
if (lastIndex > lastLastIndex) { |
|||
output.push(str.slice(lastLastIndex, match.index)); |
|||
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
|||
// nonparticipating capturing groups
|
|||
if (!compliantExecNpcg && match.length > 1) { |
|||
match[0].replace(separator2, function() { |
|||
for (var i = 1; i < arguments.length - 2; i++) { |
|||
if (arguments[i] === undef) { |
|||
match[i] = undef; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
if (match.length > 1 && match.index < str.length) { |
|||
Array.prototype.push.apply(output, match.slice(1)); |
|||
} |
|||
lastLength = match[0].length; |
|||
lastLastIndex = lastIndex; |
|||
if (output.length >= limit) { |
|||
break; |
|||
} |
|||
} |
|||
if (separator.lastIndex === match.index) { |
|||
separator.lastIndex++; // Avoid an infinite loop
|
|||
} |
|||
} |
|||
if (lastLastIndex === str.length) { |
|||
if (lastLength || !separator.test("")) { |
|||
output.push(""); |
|||
} |
|||
} else { |
|||
output.push(str.slice(lastLastIndex)); |
|||
} |
|||
return output.length > limit ? output.slice(0, limit) : output; |
|||
}; |
|||
|
|||
return self; |
|||
})(); |
|||
|
|||
},{}],3:[function(require,module,exports){ |
|||
// contains, add, remove, toggle
|
|||
var indexof = require('indexof') |
|||
|
|||
module.exports = ClassList |
|||
|
|||
function ClassList(elem) { |
|||
var cl = elem.classList |
|||
|
|||
if (cl) { |
|||
return cl |
|||
} |
|||
|
|||
var classList = { |
|||
add: add |
|||
, remove: remove |
|||
, contains: contains |
|||
, toggle: toggle |
|||
, toString: $toString |
|||
, length: 0 |
|||
, item: item |
|||
} |
|||
|
|||
return classList |
|||
|
|||
function add(token) { |
|||
var list = getTokens() |
|||
if (indexof(list, token) > -1) { |
|||
return |
|||
} |
|||
list.push(token) |
|||
setTokens(list) |
|||
} |
|||
|
|||
function remove(token) { |
|||
var list = getTokens() |
|||
, index = indexof(list, token) |
|||
|
|||
if (index === -1) { |
|||
return |
|||
} |
|||
|
|||
list.splice(index, 1) |
|||
setTokens(list) |
|||
} |
|||
|
|||
function contains(token) { |
|||
return indexof(getTokens(), token) > -1 |
|||
} |
|||
|
|||
function toggle(token) { |
|||
if (contains(token)) { |
|||
remove(token) |
|||
return false |
|||
} else { |
|||
add(token) |
|||
return true |
|||
} |
|||
} |
|||
|
|||
function $toString() { |
|||
return elem.className |
|||
} |
|||
|
|||
function item(index) { |
|||
var tokens = getTokens() |
|||
return tokens[index] || null |
|||
} |
|||
|
|||
function getTokens() { |
|||
var className = elem.className |
|||
|
|||
return filter(className.split(" "), isTruthy) |
|||
} |
|||
|
|||
function setTokens(list) { |
|||
var length = list.length |
|||
|
|||
elem.className = list.join(" ") |
|||
classList.length = length |
|||
|
|||
for (var i = 0; i < list.length; i++) { |
|||
classList[i] = list[i] |
|||
} |
|||
|
|||
delete list[length] |
|||
} |
|||
} |
|||
|
|||
function filter (arr, fn) { |
|||
var ret = [] |
|||
for (var i = 0; i < arr.length; i++) { |
|||
if (fn(arr[i])) ret.push(arr[i]) |
|||
} |
|||
return ret |
|||
} |
|||
|
|||
function isTruthy(value) { |
|||
return !!value |
|||
} |
|||
|
|||
},{"indexof":4}],4:[function(require,module,exports){ |
|||
|
|||
var indexOf = [].indexOf; |
|||
|
|||
module.exports = function(arr, obj){ |
|||
if (indexOf) return arr.indexOf(obj); |
|||
for (var i = 0; i < arr.length; ++i) { |
|||
if (arr[i] === obj) return i; |
|||
} |
|||
return -1; |
|||
}; |
|||
},{}],5:[function(require,module,exports){ |
|||
var h = require("./index.js"); |
|||
|
|||
module.exports = h; |
|||
|
|||
/* |
|||
$(function () { |
|||
|
|||
var newDoc = h('p', |
|||
|
|||
h('ul', 'bang bang bang'.split(/\s/).map(function (word) { |
|||
return h('li', word); |
|||
})) |
|||
); |
|||
$('body').html(newDoc.outerHTML); |
|||
}); |
|||
|
|||
*/ |
|||
|
|||
},{"./index.js":1}],6:[function(require,module,exports){ |
|||
|
|||
},{}]},{},[5]); |
|||
|
|||
return Hyperscript; |
|||
}); |
|||
Write
Preview
Loading…
Cancel
Save