olelo 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/Gemfile +3 -0
- data/README.markdown +104 -0
- data/Rakefile +92 -0
- data/bin/olelo +5 -0
- data/config.ru +86 -0
- data/config/aspects.rb +256 -0
- data/config/config.yml.default +154 -0
- data/config/initializers/00-mime_types.rb +29 -0
- data/config/initializers/01-slim.rb +2 -0
- data/config/interwiki.yml +11 -0
- data/doc/AUTHORS +7 -0
- data/doc/LICENSE +22 -0
- data/lib/olelo.rb +39 -0
- data/lib/olelo/application.rb +294 -0
- data/lib/olelo/attributes.rb +285 -0
- data/lib/olelo/config.rb +88 -0
- data/lib/olelo/extensions.rb +252 -0
- data/lib/olelo/helper.rb +290 -0
- data/lib/olelo/hooks.rb +142 -0
- data/lib/olelo/html_safe.rb +29 -0
- data/lib/olelo/initializer.rb +76 -0
- data/lib/olelo/locale.rb +63 -0
- data/lib/olelo/locale.yml +284 -0
- data/lib/olelo/menu.rb +101 -0
- data/lib/olelo/middleware/blacklist.rb +25 -0
- data/lib/olelo/middleware/degrade_mime_type.rb +19 -0
- data/lib/olelo/middleware/flash.rb +97 -0
- data/lib/olelo/middleware/force_encoding.rb +41 -0
- data/lib/olelo/page.rb +266 -0
- data/lib/olelo/patch.rb +311 -0
- data/lib/olelo/plugin.rb +188 -0
- data/lib/olelo/repository.rb +225 -0
- data/lib/olelo/routing.rb +223 -0
- data/lib/olelo/templates.rb +30 -0
- data/lib/olelo/user.rb +132 -0
- data/lib/olelo/util.rb +233 -0
- data/lib/olelo/version.rb +3 -0
- data/lib/olelo/virtualfs.rb +161 -0
- data/lib/rack/olelo_patches.rb +33 -0
- data/lib/rack/relative_redirect.rb +44 -0
- data/lib/rack/static_cache.rb +93 -0
- data/lib/yard/addons.rb +1 -0
- data/lib/yard/addons/hook_handler.rb +25 -0
- data/lib/yard/addons/override_tag.rb +14 -0
- data/lib/yard/addons/route_handler.rb +33 -0
- data/lib/yard/addons/sanitize_anchor.rb +16 -0
- data/olelo.gemspec +31 -0
- data/plugins/aspects/changelog.rb +45 -0
- data/plugins/aspects/documentbrowser.rb +57 -0
- data/plugins/aspects/download.rb +11 -0
- data/plugins/aspects/highlight.rb +8 -0
- data/plugins/aspects/image.rb +41 -0
- data/plugins/aspects/imageinfo.rb +64 -0
- data/plugins/aspects/locale.yml +60 -0
- data/plugins/aspects/main.rb +199 -0
- data/plugins/aspects/pageinfo.rb +37 -0
- data/plugins/aspects/source.rb +6 -0
- data/plugins/aspects/subpages.rb +44 -0
- data/plugins/aspects/text.rb +9 -0
- data/plugins/blog/blog.css +1 -0
- data/plugins/blog/blog.scss +37 -0
- data/plugins/blog/locale.yml +12 -0
- data/plugins/blog/main.rb +85 -0
- data/plugins/editor/locale.yml +18 -0
- data/plugins/editor/markup/main.rb +3 -0
- data/plugins/editor/markup/script.js +10 -0
- data/plugins/editor/markup/script/00-jquery.textselection.js +267 -0
- data/plugins/editor/markup/script/01-olelo.markupeditor.js +116 -0
- data/plugins/editor/markup/script/init.js +10 -0
- data/plugins/editor/preview.rb +52 -0
- data/plugins/editor/recaptcha.rb +56 -0
- data/plugins/filters/creole.rb +37 -0
- data/plugins/filters/disposition.rb +9 -0
- data/plugins/filters/editsection.rb +67 -0
- data/plugins/filters/fix_img_tag.rb +16 -0
- data/plugins/filters/html_wrapper.rb +12 -0
- data/plugins/filters/interwiki.rb +19 -0
- data/plugins/filters/link_classifier.rb +26 -0
- data/plugins/filters/locale.yml +15 -0
- data/plugins/filters/main.rb +202 -0
- data/plugins/filters/markdown_nowiki.rb +15 -0
- data/plugins/filters/numbering.xsl +93 -0
- data/plugins/filters/orgmode.rb +6 -0
- data/plugins/filters/rubypants.rb +6 -0
- data/plugins/filters/s5/main.rb +32 -0
- data/plugins/filters/s5/s5.xsl +118 -0
- data/plugins/filters/tilt.rb +17 -0
- data/plugins/filters/toc.rb +50 -0
- data/plugins/filters/xhtml2latex.xsl +232 -0
- data/plugins/filters/xslt.rb +22 -0
- data/plugins/gallery/gallery.css +1 -0
- data/plugins/gallery/gallery.scss +28 -0
- data/plugins/gallery/main.rb +34 -0
- data/plugins/misc/fancybox/images/blank.gif +0 -0
- data/plugins/misc/fancybox/images/fancy_close.png +0 -0
- data/plugins/misc/fancybox/images/fancy_loading.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_right.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_e.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_n.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_ne.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_nw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_s.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_se.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_sw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_w.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_main.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_over.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_right.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-x.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-y.png +0 -0
- data/plugins/misc/fancybox/images/fancybox.png +0 -0
- data/plugins/misc/fancybox/jquery.fancybox.css +1 -0
- data/plugins/misc/fancybox/jquery.fancybox.scss +323 -0
- data/plugins/misc/fancybox/main.rb +4 -0
- data/plugins/misc/fancybox/script.js +37 -0
- data/plugins/misc/fancybox/script/00-jquery.mousewheel.js +84 -0
- data/plugins/misc/fancybox/script/01-jquery.easing.js +205 -0
- data/plugins/misc/fancybox/script/02-jquery.fancybox.js +1156 -0
- data/plugins/misc/fancybox/script/init.js +18 -0
- data/plugins/misc/system.rb +192 -0
- data/plugins/misc/variables.rb +29 -0
- data/plugins/misc/webdav.rb +45 -0
- data/plugins/repositories/git_grep.rb +69 -0
- data/plugins/repositories/gitrb_repository.rb +204 -0
- data/plugins/repositories/locale.yml +12 -0
- data/plugins/repositories/rugged_repository.rb +454 -0
- data/plugins/security/acl.rb +57 -0
- data/plugins/security/basic_auth.rb +21 -0
- data/plugins/security/locale.yml +21 -0
- data/plugins/security/persistent_login.rb +32 -0
- data/plugins/security/portal.rb +28 -0
- data/plugins/security/private_wiki.rb +24 -0
- data/plugins/security/readonly_wiki.rb +25 -0
- data/plugins/security/stack.rb +20 -0
- data/plugins/security/yamlfile.rb +66 -0
- data/plugins/tags/code.rb +6 -0
- data/plugins/tags/footnotes.rb +35 -0
- data/plugins/tags/gist-embed.css +123 -0
- data/plugins/tags/gist.rb +13 -0
- data/plugins/tags/html.rb +57 -0
- data/plugins/tags/include.rb +20 -0
- data/plugins/tags/main.rb +353 -0
- data/plugins/tags/math.rb +117 -0
- data/plugins/tags/scripting.rb +64 -0
- data/plugins/tags/sort.rb +7 -0
- data/plugins/tags/tabs.rb +20 -0
- data/plugins/treeview/images/collapsed.png +0 -0
- data/plugins/treeview/images/expanded.png +0 -0
- data/plugins/treeview/images/menu.png +0 -0
- data/plugins/treeview/images/tree.png +0 -0
- data/plugins/treeview/images/wait.gif +0 -0
- data/plugins/treeview/main.rb +16 -0
- data/plugins/treeview/script.js +5 -0
- data/plugins/treeview/script/00-jquery.treeview.js +164 -0
- data/plugins/treeview/script/init.js +25 -0
- data/plugins/treeview/treeview.css +1 -0
- data/plugins/treeview/treeview.scss +113 -0
- data/plugins/utils/assets.rb +74 -0
- data/plugins/utils/cache.rb +53 -0
- data/plugins/utils/image_magick.rb +34 -0
- data/plugins/utils/pygments.css +1 -0
- data/plugins/utils/pygments.rb +50 -0
- data/plugins/utils/pygments.scss +83 -0
- data/plugins/utils/semaphore.rb +50 -0
- data/plugins/utils/shell.rb +45 -0
- data/plugins/utils/store.rb +315 -0
- data/plugins/utils/worker.rb +36 -0
- data/plugins/utils/xml.rb +29 -0
- data/static/images/favicon.png +0 -0
- data/static/script.js +267 -0
- data/static/script/00-json2.js +486 -0
- data/static/script/01-jstorage.js +217 -0
- data/static/script/02-jquery.js +9440 -0
- data/static/script/03-jquery.ui.core.js +337 -0
- data/static/script/04-jquery.ui.widget.js +502 -0
- data/static/script/05-jquery.ui.position.js +517 -0
- data/static/script/06-jquery.ui.menu.js +609 -0
- data/static/script/07-jquery.ui.autocomplete.js +601 -0
- data/static/script/08-olelo.i18n.js +37 -0
- data/static/script/09-olelo.unsaved.js +68 -0
- data/static/script/10-olelo.historytable.js +40 -0
- data/static/script/11-olelo.pagination.js +18 -0
- data/static/script/13-olelo.tabwidget.js +57 -0
- data/static/script/14-olelo.timeago.js +70 -0
- data/static/script/15-olelo.underliner.js +31 -0
- data/static/script/16-olelo.ui.combobox.js +32 -0
- data/static/script/init.js +48 -0
- data/static/themes/atlantis/constants.scss +15 -0
- data/static/themes/atlantis/iehacks.scss +38 -0
- data/static/themes/atlantis/images/actions/delete.png +0 -0
- data/static/themes/atlantis/images/actions/edit.png +0 -0
- data/static/themes/atlantis/images/actions/history.png +0 -0
- data/static/themes/atlantis/images/actions/home.png +0 -0
- data/static/themes/atlantis/images/actions/move.png +0 -0
- data/static/themes/atlantis/images/actions/new.png +0 -0
- data/static/themes/atlantis/images/actions/page.png +0 -0
- data/static/themes/atlantis/images/bg/button.png +0 -0
- data/static/themes/atlantis/images/bg/container.png +0 -0
- data/static/themes/atlantis/images/bg/content.png +0 -0
- data/static/themes/atlantis/images/bg/footer.png +0 -0
- data/static/themes/atlantis/images/bg/header.jpg +0 -0
- data/static/themes/atlantis/images/bg/header.orig.jpg +0 -0
- data/static/themes/atlantis/images/bg/header_gray.jpg +0 -0
- data/static/themes/atlantis/images/bug.png +0 -0
- data/static/themes/atlantis/images/filetypes/7z.png +0 -0
- data/static/themes/atlantis/images/filetypes/_archive.png +0 -0
- data/static/themes/atlantis/images/filetypes/_audio.png +0 -0
- data/static/themes/atlantis/images/filetypes/_code.png +0 -0
- data/static/themes/atlantis/images/filetypes/_linux.png +0 -0
- data/static/themes/atlantis/images/filetypes/_picture.png +0 -0
- data/static/themes/atlantis/images/filetypes/_video.png +0 -0
- data/static/themes/atlantis/images/filetypes/bz2.png +0 -0
- data/static/themes/atlantis/images/filetypes/doc.png +0 -0
- data/static/themes/atlantis/images/filetypes/flac.png +0 -0
- data/static/themes/atlantis/images/filetypes/gz.png +0 -0
- data/static/themes/atlantis/images/filetypes/html.png +0 -0
- data/static/themes/atlantis/images/filetypes/java.png +0 -0
- data/static/themes/atlantis/images/filetypes/jpg.png +0 -0
- data/static/themes/atlantis/images/filetypes/midi.png +0 -0
- data/static/themes/atlantis/images/filetypes/mp3.png +0 -0
- data/static/themes/atlantis/images/filetypes/ogg.png +0 -0
- data/static/themes/atlantis/images/filetypes/pdf.png +0 -0
- data/static/themes/atlantis/images/filetypes/php.png +0 -0
- data/static/themes/atlantis/images/filetypes/png.png +0 -0
- data/static/themes/atlantis/images/filetypes/ppt.png +0 -0
- data/static/themes/atlantis/images/filetypes/psd.png +0 -0
- data/static/themes/atlantis/images/filetypes/rar.png +0 -0
- data/static/themes/atlantis/images/filetypes/rb.png +0 -0
- data/static/themes/atlantis/images/filetypes/sh.png +0 -0
- data/static/themes/atlantis/images/filetypes/tar.png +0 -0
- data/static/themes/atlantis/images/filetypes/txt.png +0 -0
- data/static/themes/atlantis/images/filetypes/wma.png +0 -0
- data/static/themes/atlantis/images/filetypes/xls.png +0 -0
- data/static/themes/atlantis/images/filetypes/zip.png +0 -0
- data/static/themes/atlantis/images/folder.png +0 -0
- data/static/themes/atlantis/images/folder_open.png +0 -0
- data/static/themes/atlantis/images/loading.gif +0 -0
- data/static/themes/atlantis/images/loading.xcf +0 -0
- data/static/themes/atlantis/images/not_found.png +0 -0
- data/static/themes/atlantis/images/page.png +0 -0
- data/static/themes/atlantis/images/search.png +0 -0
- data/static/themes/atlantis/layout.scss +115 -0
- data/static/themes/atlantis/menu.scss +99 -0
- data/static/themes/atlantis/print.scss +129 -0
- data/static/themes/atlantis/screen.scss +495 -0
- data/static/themes/atlantis/style.css +3 -0
- data/static/themes/lib/autocomplete.scss +39 -0
- data/static/themes/lib/headlines.scss +10 -0
- data/static/themes/lib/horizontal-list.scss +31 -0
- data/static/themes/lib/patch.scss +88 -0
- data/static/themes/lib/reset.scss +114 -0
- data/static/themes/lib/rounded.scss +46 -0
- data/static/themes/lib/shadow.scss +14 -0
- data/test/config_test.rb +28 -0
- data/test/factory_test.rb +29 -0
- data/test/hash_extensions_test.rb +16 -0
- data/test/helper.rb +38 -0
- data/test/hooks_test.rb +85 -0
- data/test/object_extensions_test.rb +20 -0
- data/test/page_test.rb +168 -0
- data/test/request_test.rb +166 -0
- data/test/string_extensions_test.rb +32 -0
- data/test/templates_test.rb +39 -0
- data/test/util_test.rb +71 -0
- data/views/changes.slim +22 -0
- data/views/compare.slim +8 -0
- data/views/delete.slim +9 -0
- data/views/deleted.slim +2 -0
- data/views/edit.slim +65 -0
- data/views/error.slim +6 -0
- data/views/history.slim +20 -0
- data/views/layout.slim +38 -0
- data/views/login.slim +37 -0
- data/views/move.slim +10 -0
- data/views/not_found.slim +6 -0
- data/views/profile.slim +26 -0
- data/views/show.slim +9 -0
- metadata +488 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
// Very simple i18n plugin
|
2
|
+
// Written by Daniel Mendler
|
3
|
+
(function($) {
|
4
|
+
var locale = null, translations = {};
|
5
|
+
$.translations = function(t) {
|
6
|
+
for (var lang in t) {
|
7
|
+
if (!translations[lang]) {
|
8
|
+
translations[lang] = t[lang];
|
9
|
+
} else {
|
10
|
+
for (var name in t[lang]) {
|
11
|
+
translations[lang][name] = t[lang][name];
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
function lookup(locale, name) {
|
17
|
+
var t = translations[locale];
|
18
|
+
return t && t[name];
|
19
|
+
}
|
20
|
+
$.t = function(name, args) {
|
21
|
+
if (!locale) {
|
22
|
+
var html = $('html');
|
23
|
+
locale = html.attr('lang') || html.attr('xml:lang') || 'en';
|
24
|
+
}
|
25
|
+
var i, s = lookup(locale, name);
|
26
|
+
if (!s && (i = locale.indexOf('-'))) {
|
27
|
+
s = lookup(locale.substr(0, i), name);
|
28
|
+
}
|
29
|
+
if (s) {
|
30
|
+
for (var key in args) {
|
31
|
+
s = s.replace(new RegExp('#{' + key + '}', 'g'), args[key]);
|
32
|
+
}
|
33
|
+
return s;
|
34
|
+
}
|
35
|
+
return '#' + name;
|
36
|
+
};
|
37
|
+
})(jQuery);
|
@@ -0,0 +1,68 @@
|
|
1
|
+
(function($) {
|
2
|
+
// Add treeview translations
|
3
|
+
$.translations({
|
4
|
+
en: {
|
5
|
+
confirmUnsaved: 'The page was not saved. Continue?',
|
6
|
+
pageUnsaved: 'The page was not saved.'
|
7
|
+
},
|
8
|
+
de: {
|
9
|
+
confirmUnsaved: 'Die Seite wurde nicht gespeichert. Fortsetzen?',
|
10
|
+
pageUnsaved: 'Die Seite wurde nicht gespeichert.'
|
11
|
+
},
|
12
|
+
cs: {
|
13
|
+
confirmUnsaved: 'Stránka nebyla uložena. Pokračovat?',
|
14
|
+
pageUnsaved: 'Stránka nebyla uložena.'
|
15
|
+
}
|
16
|
+
});
|
17
|
+
|
18
|
+
function updateUnsaved() {
|
19
|
+
var unsaved = false;
|
20
|
+
switch (this.type) {
|
21
|
+
case 'checkbox':
|
22
|
+
case 'radio':
|
23
|
+
unsaved = this.checked != this.defaultChecked;
|
24
|
+
break;
|
25
|
+
case 'hidden':
|
26
|
+
case 'password':
|
27
|
+
case 'text':
|
28
|
+
case 'textarea':
|
29
|
+
case 'file':
|
30
|
+
unsaved = this.value != this.defaultValue;
|
31
|
+
break;
|
32
|
+
case 'select-one':
|
33
|
+
case 'select-multiple':
|
34
|
+
for (var i = 0; i < this.options.length && !unsaved; ++i) {
|
35
|
+
unsaved = this.options[i].selected != this.options[i].defaultSelected;
|
36
|
+
}
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
$('label[for=' + this.id + ']').toggleClass('unsaved', unsaved);
|
40
|
+
$(this).toggleClass('unsaved', unsaved);
|
41
|
+
}
|
42
|
+
|
43
|
+
function hasUnsavedChanges(element) {
|
44
|
+
$('input.observe, textarea.observe, select.observe').each(function() {
|
45
|
+
updateUnsaved.call(this);
|
46
|
+
});
|
47
|
+
return $('.unsaved', element).size() !== 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
$.fn.confirmUnsaved = function() {
|
51
|
+
return !hasUnsavedChanges(this) || confirm($.t('confirmUnsaved'));
|
52
|
+
};
|
53
|
+
|
54
|
+
$('input.observe, textarea.observe, select.observe').live('change autocompletechange', updateUnsaved);
|
55
|
+
|
56
|
+
var submitForm = false;
|
57
|
+
$('form').live('submit', function() {
|
58
|
+
submitForm = true;
|
59
|
+
}).bind('reset', function() {
|
60
|
+
$('.unsaved', this).removeClass('unsaved');
|
61
|
+
});
|
62
|
+
|
63
|
+
$(window).bind('beforeunload', function() {
|
64
|
+
if (!submitForm && hasUnsavedChanges(document)) {
|
65
|
+
return $.t('pageUnsaved');
|
66
|
+
}
|
67
|
+
});
|
68
|
+
})(jQuery);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
(function($) {
|
2
|
+
$.fn.historyTable = function() {
|
3
|
+
$('thead tr', this).prepend('<th class="compare"><button>±</button></th>');
|
4
|
+
$('tbody tr', this).each(function() {
|
5
|
+
var version = $(this).attr('id').substr(8);
|
6
|
+
$(this).prepend('<td class="compare"><input type="checkbox" name="' + version + '"/></td>');
|
7
|
+
});
|
8
|
+
var versions = jStorage.get('historyTable');
|
9
|
+
if (versions) {
|
10
|
+
for (var i = 0; i < versions.length; ++i)
|
11
|
+
$('input[name=' + versions[i] + ']').attr('checked', 'checked');
|
12
|
+
}
|
13
|
+
|
14
|
+
var checkboxes = $('tbody input', this);
|
15
|
+
function getSelectedVersions() {
|
16
|
+
var versions = [];
|
17
|
+
checkboxes.each(function() {
|
18
|
+
if (this.checked) {
|
19
|
+
versions.push(this.name);
|
20
|
+
}
|
21
|
+
});
|
22
|
+
return versions;
|
23
|
+
}
|
24
|
+
|
25
|
+
var button = $('th button', this);
|
26
|
+
button.click(function() {
|
27
|
+
var versions = getSelectedVersions();
|
28
|
+
jStorage.set('historyTable', versions);
|
29
|
+
location.href = location.pathname.replace('/history', '/compare/' + versions[versions.length-1] + '...' + versions[0]);
|
30
|
+
});
|
31
|
+
|
32
|
+
$('td input', this).change(function() {
|
33
|
+
var versions = getSelectedVersions();
|
34
|
+
if (versions.length > 1)
|
35
|
+
button.removeAttr('disabled');
|
36
|
+
else
|
37
|
+
button.attr('disabled', 'disabled');
|
38
|
+
}).change();
|
39
|
+
};
|
40
|
+
})(jQuery);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Pagination links
|
2
|
+
// $('.pagination a').pagination('#page_element');
|
3
|
+
// $('#page_element').bind('pageLoaded', function() {});
|
4
|
+
// Written by Daniel Mendler
|
5
|
+
(function($) {
|
6
|
+
$.fn.pagination = function(page) {
|
7
|
+
page = $(page);
|
8
|
+
this.live('click', function() {
|
9
|
+
$(this).addClass('loading');
|
10
|
+
var href = this.href;
|
11
|
+
href += (href.indexOf('?') < 0 ? '?' : '&') + 'no_layout=1';
|
12
|
+
page.load(href, function() {
|
13
|
+
page.trigger('pageLoaded', [href]);
|
14
|
+
});
|
15
|
+
return false;
|
16
|
+
});
|
17
|
+
};
|
18
|
+
})(jQuery);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
// Simple, unobtrusive tab widget
|
2
|
+
// Written by Daniel Mendler
|
3
|
+
(function($) {
|
4
|
+
$.fn.tabWidget = function(options) {
|
5
|
+
var store = options && options.store;
|
6
|
+
var selected = null;
|
7
|
+
|
8
|
+
// Handle tab clicks
|
9
|
+
$("> a[href^='#']", this).click(function() {
|
10
|
+
if (selected.data('tab') == $(this).data('tab')) {
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
if (!selected.data('tab').confirmUnsaved()) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
selected.data('tab').hide();
|
17
|
+
selected.parent().removeClass('selected');
|
18
|
+
selected = $(this);
|
19
|
+
selected.data('tab').show();
|
20
|
+
selected.parent().addClass('selected');
|
21
|
+
if (store) {
|
22
|
+
jStorage.set(store, selected.data('tab').attr('id'));
|
23
|
+
}
|
24
|
+
return false;
|
25
|
+
});
|
26
|
+
|
27
|
+
// Get selected tab from store
|
28
|
+
if (store) {
|
29
|
+
var name = jStorage.get(store);
|
30
|
+
if (name) {
|
31
|
+
selected = $("> a[href='#" + name + "']", this);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
// Get selected tab by class
|
36
|
+
if (!selected || selected.size() === 0) {
|
37
|
+
selected = $(this).filter('.selected').find("> a[href^='#']");
|
38
|
+
}
|
39
|
+
|
40
|
+
// Select first tab
|
41
|
+
if (!selected || selected.size() === 0) {
|
42
|
+
selected = $(this).filter(':first').find("> a[href^='#']");
|
43
|
+
}
|
44
|
+
|
45
|
+
// Find all tabs and hide them
|
46
|
+
$("> a[href^='#']", this).each(function() {
|
47
|
+
var tab = $(this.href.match(/(#.*)$/)[1]);
|
48
|
+
tab.hide();
|
49
|
+
$(this).data('tab', tab);
|
50
|
+
});
|
51
|
+
|
52
|
+
// Show initially selected tab
|
53
|
+
this.removeClass('selected');
|
54
|
+
selected.parent().addClass('selected');
|
55
|
+
selected.data('tab').show();
|
56
|
+
};
|
57
|
+
})(jQuery);
|
@@ -0,0 +1,70 @@
|
|
1
|
+
// Replace timestamps with relative time
|
2
|
+
// Written by Daniel Mendler
|
3
|
+
(function($) {
|
4
|
+
$.translations({
|
5
|
+
en: {
|
6
|
+
less_than_a_minute_ago: 'less than a minute ago',
|
7
|
+
a_minute_ago: 'a minute ago',
|
8
|
+
n_minutes_ago: '#{n} minutes ago',
|
9
|
+
one_hour_ago: '1 hour ago',
|
10
|
+
n_hours_ago: '#{n} hours ago',
|
11
|
+
one_day_ago: '1 day ago',
|
12
|
+
n_days_ago: '#{n} days ago',
|
13
|
+
one_month_ago: '1 month ago',
|
14
|
+
n_months_ago: '#{n} months ago',
|
15
|
+
one_year_ago: '1 year ago',
|
16
|
+
over_n_years_ago: 'over #{n} years ago'
|
17
|
+
},
|
18
|
+
de: {
|
19
|
+
less_than_a_minute_ago: 'vor weniger als einer Minute',
|
20
|
+
a_minute_ago: 'vor einer Minute',
|
21
|
+
n_minutes_ago: 'vor #{n} Minuten',
|
22
|
+
one_hour_ago: 'vor einer Stunde',
|
23
|
+
n_hours_ago: 'vor #{n} Stunden',
|
24
|
+
one_day_ago: 'vor einem Tag',
|
25
|
+
n_days_ago: 'vor #{n} Tagen',
|
26
|
+
one_month_ago: 'vor einem Monat',
|
27
|
+
n_months_ago: 'vor #{n} Monaten',
|
28
|
+
one_year_ago: 'vor einem Jahr',
|
29
|
+
over_n_years_ago: 'vor über #{n} Jahren'
|
30
|
+
},
|
31
|
+
cs: {
|
32
|
+
less_than_a_minute_ago: 'méně než 1 minuta',
|
33
|
+
a_minute_ago: 'před minutou',
|
34
|
+
n_minutes_ago: 'před #{n} minutami',
|
35
|
+
one_hour_ago: 'před hodinou',
|
36
|
+
n_hours_ago: 'před #{n} hodinami',
|
37
|
+
one_day_ago: 'jeden den',
|
38
|
+
n_days_ago: 'před #{n} dny',
|
39
|
+
one_month_ago: 'jeden měsíc',
|
40
|
+
n_months_ago: 'před #{n} měsíci',
|
41
|
+
one_year_ago: '1 rok',
|
42
|
+
over_n_years_ago: 'před #{n} lety'
|
43
|
+
}
|
44
|
+
});
|
45
|
+
|
46
|
+
function timeAgo(from) {
|
47
|
+
var n = Math.floor((new Date().getTime() - new Date(from * 1000)) / 60000);
|
48
|
+
if (n <= 0) { return $.t('less_than_a_minute_ago'); }
|
49
|
+
if (n == 1) { return $.t('a_minute_ago'); }
|
50
|
+
if (n < 45) { return $.t('n_minutes_ago', {n: n}); }
|
51
|
+
if (n < 90) { return $.t('one_hour_ago'); }
|
52
|
+
if (n < 1440) { return $.t('n_hours_ago', {n: Math.round(n / 60)}); }
|
53
|
+
if (n < 2880) { return $.t('one_day_ago'); }
|
54
|
+
if (n < 43200) { return $.t('n_days_ago', {n: Math.round(n / 1440)}); }
|
55
|
+
if (n < 86400) { return $.t('one_month_ago'); }
|
56
|
+
if (n < 525960) { return $.t('n_months_ago', {n: Math.round(n / 43200)}); }
|
57
|
+
if (n < 1051920) { return $.t('one_year_ago'); }
|
58
|
+
return $.t('over_n_years_ago', {n: Math.round(n / 525960)});
|
59
|
+
}
|
60
|
+
|
61
|
+
$.fn.timeAgo = function() {
|
62
|
+
this.each(function() {
|
63
|
+
var elem = $(this);
|
64
|
+
var epoch = elem.data('epoch');
|
65
|
+
if (epoch) {
|
66
|
+
elem.attr('title', elem.text()).html(timeAgo(epoch));
|
67
|
+
}
|
68
|
+
});
|
69
|
+
};
|
70
|
+
})(jQuery);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// Underline text in elements. Especially useful for accesskeys.
|
2
|
+
// Written by Daniel Mendler
|
3
|
+
(function($) {
|
4
|
+
$.extend($.fn, {
|
5
|
+
// Underline text
|
6
|
+
underlineText: function(str) {
|
7
|
+
this.each(function() {
|
8
|
+
var elem = $(this), text, i;
|
9
|
+
if (elem.children().size() === 0) {
|
10
|
+
text = elem.text();
|
11
|
+
i = text.toLowerCase().indexOf(str.toLowerCase());
|
12
|
+
if (i >= 0) {
|
13
|
+
elem.html(text.substr(0, i) + '<span style="text-decoration: underline">' +
|
14
|
+
text.substr(i, str.length) + '</span>' + text.substr(i+str.length));
|
15
|
+
}
|
16
|
+
} else {
|
17
|
+
elem.children().underlineText(str);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
},
|
21
|
+
// Underline access key
|
22
|
+
underlineAccessKey: function() {
|
23
|
+
this.each(function() {
|
24
|
+
var key = $(this).attr('accesskey');
|
25
|
+
if (key) {
|
26
|
+
$(this).underlineText(key);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
}
|
30
|
+
});
|
31
|
+
})(jQuery);
|
@@ -0,0 +1,32 @@
|
|
1
|
+
(function($) {
|
2
|
+
$.widget('ui.combobox', {
|
3
|
+
_create: function() {
|
4
|
+
var input = this.element;
|
5
|
+
input.autocomplete({
|
6
|
+
delay: 0,
|
7
|
+
minLength: 0,
|
8
|
+
source: this.options.source
|
9
|
+
}).click(function() {
|
10
|
+
if (input.autocomplete('widget').is(':visible')) {
|
11
|
+
input.autocomplete('close');
|
12
|
+
} else {
|
13
|
+
input.autocomplete('search', this.value);
|
14
|
+
}
|
15
|
+
});
|
16
|
+
$('<button class="ui-combo-button"/>')
|
17
|
+
.attr('tabIndex', -1)
|
18
|
+
.insertAfter(input)
|
19
|
+
.click(function(event) {
|
20
|
+
event.preventDefault();
|
21
|
+
// close if already visible
|
22
|
+
if (input.autocomplete('widget').is(':visible')) {
|
23
|
+
input.autocomplete('close');
|
24
|
+
} else {
|
25
|
+
// pass empty string as value to search for, displaying all results
|
26
|
+
input.autocomplete('search', '');
|
27
|
+
input.focus();
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
});
|
32
|
+
})(jQuery);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// Olelo bootstrap
|
2
|
+
// Written by Daniel Mendler
|
3
|
+
$(function() {
|
4
|
+
$('html').removeClass('no-js').addClass('js');
|
5
|
+
function pageLoaded(parent) {
|
6
|
+
$('#upload-path', parent).each(function() {
|
7
|
+
var elem = this;
|
8
|
+
var old = elem.value;
|
9
|
+
var base = elem.value;
|
10
|
+
if (base.length === 0 || base.match(/\/$/)) {
|
11
|
+
$('#upload-file').change(function() {
|
12
|
+
if (elem.value == old) {
|
13
|
+
elem.value = base + this.value;
|
14
|
+
old = elem.value;
|
15
|
+
}
|
16
|
+
});
|
17
|
+
}
|
18
|
+
});
|
19
|
+
$('label, #menu, .tabhead, .pagination, .button-bar', parent).disableSelection();
|
20
|
+
$('#history-table', parent).historyTable();
|
21
|
+
$('.date', parent).timeAgo();
|
22
|
+
$('.tabs', parent).each(function() {
|
23
|
+
$('> li', this).tabWidget();
|
24
|
+
});
|
25
|
+
$('*[accesskey]', parent).underlineAccessKey();
|
26
|
+
}
|
27
|
+
|
28
|
+
$('.pagination a').pagination('#content');
|
29
|
+
$('#content').bind('pageLoaded', function() { pageLoaded(this); });
|
30
|
+
pageLoaded();
|
31
|
+
|
32
|
+
$('button[data-target]').live('click', function() {
|
33
|
+
var button = $(this);
|
34
|
+
var form = $(this.form);
|
35
|
+
button.addClass('loading');
|
36
|
+
$.ajax({
|
37
|
+
type: form.attr('method') || 'get',
|
38
|
+
url: form.attr('action') || window.location.href,
|
39
|
+
data: form.serialize() + '&' + button.attr('name') + '=' + button.attr('value') + '&no_layout=1',
|
40
|
+
success: function(data) {
|
41
|
+
$('#' + button.data('target')).html(data);
|
42
|
+
button.removeClass('loading');
|
43
|
+
if (window.MathJax)
|
44
|
+
MathJax.Hub.Queue(['Typeset',MathJax.Hub,button.data('target')]);
|
45
|
+
}});
|
46
|
+
return false;
|
47
|
+
});
|
48
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$border_color: #BBB;
|
2
|
+
$border: 1px solid $border_color;
|
3
|
+
$color1: #153b7a;
|
4
|
+
$main_bg: white;
|
5
|
+
$light_bg: #e5efff;
|
6
|
+
$light_bg1: #d4e4ff;
|
7
|
+
$sidebar_width: 156px;
|
8
|
+
$content_padding: 3.5em;
|
9
|
+
$dark_color: #333333;
|
10
|
+
$light_color: #555555;
|
11
|
+
$header_bg: url(images/bg/header.jpg) $color1;
|
12
|
+
$header_bg2: url(images/bg/header_gray.jpg) $dark_color;
|
13
|
+
$headline_font: 'Book Antiqua', Palatino, FreeSerif, serif;
|
14
|
+
$normal_font: 'URW Gothic L', 'DejaVu Sans', Verdana, sans-serif;
|
15
|
+
$monospace_font: 'Andale Mono', 'Bitstream Vera Sans Mono', monospace;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// IE 6 hack
|
2
|
+
* html {
|
3
|
+
#container {
|
4
|
+
// little offset to avoid wrapping
|
5
|
+
// wrong box model computations?
|
6
|
+
width: 100%;
|
7
|
+
padding: 0;
|
8
|
+
background: transparent;
|
9
|
+
border-bottom: $border;
|
10
|
+
}
|
11
|
+
#sidebar {
|
12
|
+
margin: 0;
|
13
|
+
border-right: $border;
|
14
|
+
border-bottom: $border;
|
15
|
+
}
|
16
|
+
#content {
|
17
|
+
width: 70%;
|
18
|
+
background: transparent;
|
19
|
+
}
|
20
|
+
#footer {
|
21
|
+
background: transparent;
|
22
|
+
margin-top: 0;
|
23
|
+
padding-top: 0;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
// IE 7 hack
|
28
|
+
*:first-child+html {
|
29
|
+
#container {
|
30
|
+
// little offset to avoid wrapping
|
31
|
+
// wrong box model computations?
|
32
|
+
padding-right: 7.1em;
|
33
|
+
}
|
34
|
+
#menu ul li li {
|
35
|
+
// IE 7 does not understand width: 100%
|
36
|
+
width: 8em;
|
37
|
+
}
|
38
|
+
}
|