はじまりの大地

This commit is contained in:
miteruzo
2024-07-08 03:32:47 +09:00
commit c616a96f53
7749 changed files with 478270 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
jQuery(function () {
jQuery('#dokuwiki__content.main-content').find('h1,h2,h3,h4,h5').append(function () {
if (this.id) {
return '<a href="#' + this.id + '" class="anchor">' +
'<svg viewBox="2 2 22 22">' +
'<path d="M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z" />' +
'</svg>' +
'</a>';
} else {
return '';
}
})
});
+7
View File
@@ -0,0 +1,7 @@
/**
* Module: rem - v1.3.2
* Description: A polyfill to parse CSS links and rewrite pixel equivalents into head for non supporting browsers
* Date Built: 2014-07-02
* Copyright (c) 2014 | Chuck Carpenter <chuck.carpenter@me.com>,Lucas Serven <lserven@gmail.com>;
**/
!function(e){"use strict";var t=function(){var e=document.createElement("div");return e.style.cssText="font-size: 1rem;",/rem/.test(e.style.fontSize)},n=function(){for(var e=document.getElementsByTagName("link"),t=[],n=0;n<e.length;n++)"stylesheet"===e[n].rel.toLowerCase()&&null===e[n].getAttribute("data-norem")&&t.push(e[n].href);return t},r=function(){for(var e=0;e<h.length;e++)l(h[e],o)},o=function(e,t){if(p.push(e.responseText),v.push(t),v.length===h.length){for(var n=0;n<v.length;n++)a(p[n],v[n]);(h=m.slice(0)).length>0?(v=[],p=[],m=[],r()):i()}},a=function(e,t){for(var n,r=d(e).replace(/\/\*[\s\S]*?\*\//g,""),o=/[\w\d\s\-\/\\\[\]:,.'"*()<>+~%#^$_=|@]+\{[\w\d\s\-\/\\%#:!;,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!;,.'"*()]*\}/g,a=r.match(o),i=/\d*\.?\d+rem/g,s=r.match(i),c=/(.*\/)/,l=c.exec(t)[0],u=/@import (?:url\()?['"]?([^'\)"]*)['"]?\)?[^;]*/gm;null!==(n=u.exec(e));)m.push(0===n[1].indexOf("/")?n[1]:l+n[1]);null!==a&&0!==a.length&&(f=f.concat(a),g=g.concat(s))},i=function(){for(var e=/[\w\d\s\-\/\\%#:,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!,.'"*()]*[;}]/g,t=0;t<f.length;t++){u+=f[t].substr(0,f[t].indexOf("{")+1);for(var n=f[t].match(e),r=0;r<n.length;r++)u+=n[r],r===n.length-1&&"}"!==u[u.length-1]&&(u+="\n}")}s()},s=function(){for(var e=0;e<g.length;e++)y[e]=Math.round(parseFloat(g[e].substr(0,g[e].length-3)*w))+"px";c()},c=function(){for(var e=0;e<y.length;e++)y[e]&&(u=u.replace(g[e],y[e]));var t=document.createElement("style");t.setAttribute("type","text/css"),t.id="remReplace",document.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=u:t.appendChild(document.createTextNode(u))},l=function(t,n){try{var r=e.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP")||new ActiveXObject("Msxml2.XMLHTTP"):new XMLHttpRequest;r.open("GET",t,!0),r.onreadystatechange=function(){4===r.readyState&&n(r,t)},r.send(null)}catch(o){if(e.XDomainRequest){var a=new XDomainRequest;a.open("get",t),a.onload=function(){n(a,t)},a.onerror=function(){return!1},a.send()}}},d=function(t){return e.matchMedia||e.msMatchMedia||(t=t.replace(/@media[\s\S]*?\}\s*\}/g,"")),t};if(!t()){var u="",h=n(),m=[],f=[],g=[],p=[],v=[],y=[],w="";w=function(){var e,t=document,n=t.documentElement,r=t.body||t.createElement("body"),o=!t.body,a=t.createElement("div"),i=r.style.fontSize;return o&&n.appendChild(r),a.style.cssText="width:1em; position:absolute; visibility:hidden; padding: 0;",r.style.fontSize="1em",r.appendChild(a),e=a.offsetWidth,o?n.removeChild(r):(r.removeChild(a),r.style.fontSize=i),e}(),r()}}(window);
+259
View File
@@ -0,0 +1,259 @@
/**
* @file utility funcs for jQuery projects
*
*/
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
// object literal with funcs for jquery plug-ins
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
var spc = {
/*general options */
config: {
debug: false,
dev: true
},
isDef: function(val){
return (val===undefined) ? false : true;
},
/* get options of object */
get_options: function(key, options){
var result = null;
if ('object' == typeof(options)) {
result = options[key];
}
if (!result) { return ""; }
return result;
},
/* set wai aria roles to list of containern */
set_wa: function(contlist, ariaattr,ariaval){
$(contlist).attr(ariaattr, ariaval);
},
/* Encode/decode htmlentities */
encode_entities: function(s){
return $("<acronym/>").text(s).html();
},
decode_entities: function(s){
return $("<acronym/>").html(s).text();
},
/* add func to load event */
add_loadEvent: function(func_name){
var lastonload = window.onload;
if (typeof window.onload != 'function') { window.onload = func_name; }
else { window.onload = function() { lastonload(); func_name(); }; }
},
/* logging for debug */
_debug: function(msg){
if(this.config.debug) {
try{
if(console){
console.log(msg);
} else{
alert(msg);
}
}catch(err){
alert(msg);
}
}
},
/* return obj values for debug */
_get_objVs: function(objl){
try{
var p = typeof JSON != "undefined" ? JSON.stringify : function(objl){
var arr = [];
$.each(objl,function(key,val){
var next = key + ": ";
next += $.isPlainObject(val) ? printObj(val) : val;
arr.push( next );
});
return "{ " + arr.join(", ") + " }";
};
return p(objl);
}catch(err){
this._debug(err);
return '';
}
},
aria_live: function(setobj){
if(typeof(setobj)=='object'){
setobj.attr('aria-live',"polite");
}
},
aria_role: function(setobj, role){
if(typeof(setobj)=='object'){
setobj.attr('role',role);
}
},
change_tabindex: function(remobj,setobj,i){
if(typeof(remobj)=='object'){
remobj.removeAttr('tabindex');
}
if(typeof(setobj)=='object'){
setobj.attr('tabindex',i);
}
},
/* set focus to dom object: param obj */
set_newfocusObj: function(focusobj){
try{
if(focusobj) focusobj.focus();
}catch(err){
this._debug('exception: '+err);
}
},
/* set focus to dom object: param id */
set_newfocusId: function(fid){
try{
var focusobj = document.getElementById(fid);
if(focusobj) focusobj.focus();
}catch(err){
this._debug('exception: '+err);
}
},
/* set focus to nonfocussable dom object: */
set_newfocusBox: function(remobj,setobj){
this.change_tabindex(remobj,setobj,0);
try{
if(setobj) setobj.focus();
}catch(err){
this._debug('exception: '+err);
}
},
/* set title(s) and remove other title(s) if set */
set_title: function(remobj,setobj,ctitle){
if(typeof(remobj)=='object'){
remobj.removeAttr('title');
}
if(typeof(setobj)=='object'){
setobj.attr('title',ctitle);
}
},
/* count appearances of dom elems with certain markup */
count: function(jqdom){
var num = 0;
$(jqdom).each(function() {
num++;
});
return num;
},
countOV: function(objlit){
var i = 0;
for (var elem in objlit){
i++;
}
return i;
},
/*merge object literals (do not overwrite default, not recursively) */
merge: function(objl1,objl2,objl3,objl4){
return $.extend({},objl1,objl2,objl3,objl4);
},
/*merge object literals (do not overwrite default, recursively) */
mergeR: function(objl1,objl2,objl3,objl4){
return $.extend(true,{},objl1,objl2,objl3,objl4);
},
loadImage: function(isrc, func, errfunc){
try{
var img = new Image();
img.onload = func;
img.onerror = errfunc;
img.src = isrc;
}catch(err){
errfunc();
}
},
tb_getPageSize: function(){
var de=document.documentElement;
var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;
var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;
arrayPageSize=[w,h];
return arrayPageSize;
},
useLocStorage: function(){
return ('localStorage' in window && window.localStorage !== null);
},
saveLSI: function(key, data){
if (this.useLocStorage) {
localStorage.setItem(key, data);
}
},
removeLSI: function(key){
if (this.useLocStorage) {
localStorage.removeItem(key);
}
},
getLSI: function(key){
if (this.useLocStorage) {
return localStorage.getItem(key);
}
return '';
},
showAllLSI: function() {
if (this.useLocStorage) {
var key = "";
for (var i=0; i<=localStorage.length-1; i++) {
key = localStorage.key(i);
//console.log(key+': '+localStorage.getItem(key));
}
}
}
};
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
// shuffle func for random values
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Array.prototype.shuffle = function(){
var tmp, rand;
for(var i =0; i < this.length; i++){
rand = Math.floor(Math.random() * this.length);
tmp = this[i];
this[i] = this[rand];
this[rand] =tmp;
}
};
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
// js trim func for ie
// + + + + + + + + + + + + + + + + + + + + + + + + + + + +
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
}
/**
* simplify setting and getting state out of a node
* $("#my_id").data("my_data_attr") equals $$("#my_id").my_data_attr and
* $("#my_id").data("my_data_attr", "my_data_val") equals $$("#my_id").my_data_attr = my_data_val
* you can also do
* $$("#my_id").my_data_val = $$("#my_id").my_data_val + 1.
*/
var $$ = function(param) {
var node = $(param)[0];
var id = $.data(node);
$.cache[id] = $.cache[id] || {};
$.cache[id].node = node;
return $.cache[id];
};
var alertFB = false;
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {};
if (alertFB) {
console.log = function(msg) {
alert(msg);
};
} else {
console.log = function() {};
}
}
/**
* custom event handler show/hide events for using .on()
*/
(function ($) {
$.each(['show', 'hide'], function (i, e) {
var el = $.fn[e];
$.fn[e] = function () {
this.trigger(e);
return el.apply(this, arguments);
};
});
})(jQuery);
File diff suppressed because one or more lines are too long
+130
View File
@@ -0,0 +1,130 @@
/**
* Sets up the behaviour of direct menu links
*
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*/
(function($) {
var $body,
/**
* Register the click handler for the direct links
* should scroll to the page area whether there is a fixed magic matcher bar or not
*
* @param $directMenu
*/
scrollingForDirectNav = function($directMenu) {
$body = $('body');
checkAnchorsOnLoad($directMenu);
registerClickForDirectLinks($directMenu);
},
/**
* register click event listener for direct links
* @param $menu
*/
registerClickForDirectLinks = function($menu) {
$menu.find('a').on('click', function (e) {
e.stopPropagation();
var target = $(this).attr('href');
tasksBeforeScrolling(target);
scrollToTarget(target);
});
},
/**
* scroll to / set focus to target of direct link if value of location hash equals direct link
* @param $menu
*/
checkAnchorsOnLoad = function($menu) {
var hash = window.location.hash;
if (hash) {
$menu.find('a').each(function() {
var target = $(this).attr('href');
if(hash === target) {
tasksBeforeScrolling(target);
scrollToTarget(target);
setFocusOnLoad(target);
}
});
}
},
/**
* todos that needs to be done before the scrolling can start
* @param target
*/
tasksBeforeScrolling = function(target) {
switch (target) {
case '#qsearch__in':
showSearchField(target);
break;
case '#dokuwiki__usertools':
$(target).find('li:first-child').find('a').focus();
break;
}
},
/**
* set focus on target or first link found in target
* @param target
*/
setFocusOnLoad = function(target) {
var $target = $(target);
switch (target) {
case '#qsearch__in':
case '#spr__toggle-content':
$target.focus();
break;
case '#dokuwiki__usertools':
break;
default:
$target.attr('tabindex',0);
$target.focus();
}
},
/**
* trigger content toggle link to make the search field visible otherwise it neither be used for scrolling nor
* for focus setting
* @param target
*/
showSearchField = function(target) {
if($body.hasClass('wide-content')) {
$('#spr__toggle-content').trigger('click');
}
},
/**
* scrolls to the target with an offset of 60px
* @param target
*/
scrollToTarget = function(target) {
// scroll to each target
$(target).velocity('scroll', {
duration: 400,
offset: -60,
easing: 'ease-in-out'
});
};
$(function(){
var $directMenu = $('#spr__direct');
if (!$directMenu.length) return;
scrollingForDirectNav($directMenu);
});
})(jQuery);
+8
View File
@@ -0,0 +1,8 @@
/*
HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
+5
View File
@@ -0,0 +1,5 @@
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
* */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
+91
View File
@@ -0,0 +1,91 @@
/**
* Sets up the behaviour of the meta box
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*/
(function($) {
/**
* Register the click handler for the tabs
*
* Tabs can be added dynamically later on and this handler will still
* provide the open/close functionality
*/
var registerClickForTabsInMetaBox = function($metaBox) {
$metaBox.on('click', '.meta-tabs a', function (e) {
e.preventDefault();
var $tab = $(this),
isopen = $tab.attr('aria-expanded') === 'true';
// disable all existing tabs
disableExistingTabs($metaBox);
if (isopen) return; // tab was open, we closed it. we're done
// enable current tab
$tab
.attr('aria-expanded', 'true')
.closest('li')
.addClass('active');
$metaBox.find($tab.attr('href'))
.addClass('active')
.attr('aria-hidden', 'false');
}).find('.meta-content').on('click', 'a[href*="#"]', function (e) {
disableExistingTabs($metaBox);
/* uses custome event handler hide see spc.js */
}).find('#tagging__edit').on('hide', function(e){
disableExistingTabs($metaBox);
});
/**
* in admin templates show toc tab, if available
*/
if($('body').hasClass('do-admin')) {
var $tocLink = $metaBox.find('a[href="#spr__tab-toc"]');
if($tocLink.length === 1) {
$tocLink.trigger('click');
}
}
},
disableExistingTabs = function($metaBox) {
$metaBox.find('.meta-tabs li')
.removeClass('active')
.find('a')
.attr('aria-expanded', 'false');
$metaBox.find('.meta-content .tab-pane')
.removeClass('active')
.attr('aria-hidden', 'false');
};
var stickyBox = function ($metaBox, topOffset, leftOffset) {
if (window.pageYOffset >= topOffset) {
$metaBox.addClass("sticky").attr("style", "left: " + leftOffset + "px");
} else {
$metaBox.removeClass("sticky").removeAttr("style");
}
};
$(function(){
var $metaBox = $('#spr__meta-box');
if (!$metaBox.length) return;
registerClickForTabsInMetaBox($metaBox);
var topOffset = $metaBox.offset().top;
window.onscroll = function () {
// check while scrolling, or window resizing will break horizontal positioning
var leftOffset = $metaBox.offset().left;
stickyBox($metaBox, topOffset, leftOffset)
};
});
})(jQuery);
@@ -0,0 +1,26 @@
/**
* prevents Uncaught TypeError in detail template if bookcreator plug-in is installed
*
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*
*/
(function($) {
var debugBookCreatorOnDetailTemplate = function(){
var $detail = $('#dokuwiki__detail');
if (!$detail.length) return;
if(JSINFO.bookcreator === undefined) {
JSINFO.bookcreator = {};
JSINFO.bookcreator.areToolsVisible = false;
}
};
$(function(){
debugBookCreatorOnDetailTemplate();
});
})(jQuery);
+49
View File
@@ -0,0 +1,49 @@
// FIXME figure out what this did and why
// ( function( $, spc ) {
//
// var togglePageAnalysis = function(){
// var $this = $('.page-attributes').find('.plugin__qc');
// try{
// var $link = $this.find('#plugin__qc__link'),
// $container = $this.find('#plugin__qc__wrapper');
//
// if($container.length < 1){
// $this.remove();
// }else{
// $container.attr('aria-hidden','true');
// var $icon = $container.find('#plugin__qc__icon');
// $container.find('#plugin__qc__out').removeAttr('style');
// $link.on( 'click', function(e){
// e.preventDefault();
// $icon.trigger('click');
// var oldState = ($link.attr('aria-expanded')=== "true" );
// $container.attr('aria-hidden',oldState);
// $(this).attr('aria-expanded',!oldState);
//
// });
//
// if($container.length > 0){
// var num = $container.attr('data-errors');
// if(num){
// $link.find('.num').empty().append(num);
// $link.closest('li').removeClass('do_none');
// }
// }
//
// }
//
// }catch(err){
// $this.remove();
// }
// };
//
// $(function(){
// togglePageAnalysis();
// });
//
// } )( jQuery, spc );
//
//
//
//
+27
View File
@@ -0,0 +1,27 @@
/**
* prevents Uncaught TypeError in detail template if folded plug-in is installed
*
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*
*/
(function($) {
var debugFoldedOnDetailTemplate = function(){
var $detail = $('#dokuwiki__detail');
if (!$detail.length) return;
if(JSINFO.plugin_folded === undefined) {
JSINFO.plugin_folded = {};
JSINFO.plugin_folded.reveal = '';
JSINFO.plugin_folded.hide = '';
}
};
$(function(){
debugFoldedOnDetailTemplate();
});
})(jQuery);
+40
View File
@@ -0,0 +1,40 @@
/**
* Add custom QC functionality instead of using the plugin's mechanism
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*/
jQuery(function () {
var $panel = jQuery('div.qc-output').hide();
// load summary
jQuery('.page-attributes .plugin_qc a').load(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_qc_short',
id: JSINFO['id']
},
function () {
jQuery(this).find('span span').addClass('num');
}
).click(function (e) {
e.preventDefault();
if ($panel.html() == '') {
// load output
$panel.load(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_qc_long',
id: JSINFO['id']
},
function () {
$panel.dw_show();
}
);
} else {
$panel.dw_toggle();
}
});
});
+335
View File
@@ -0,0 +1,335 @@
/**
* Sets up the sidebar behaviour
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Michael Große <gohr@cosmocode.de>
* @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*/
jQuery(function () {
var $nav = jQuery('#dokuwiki__aside');
if (!$nav.length) return;
// id of the current sidebar, used to differentiate states
var sidebarId = '';
var divId = jQuery('#sidebarId');
if (typeof divId !== 'undefined') {
sidebarId = divId.attr('class').split(' ')[0];
}
/**
* closes sidebar
*/
var setWideContent = function () {
$nav.find('div.nav-panel').hide(); // close all panels
jQuery('body').addClass('wide-content');
removeToggleStorage();
window.sessionStorage.setItem('wide-content', true);
},
/**
* removes information about the toggle-state
*/
removeToggleStorage = function () {
for (var index=0; index <= window.sessionStorage.length; index += 1) {
var item = window.sessionStorage.getItem('sidebar-section-' + sidebarId + '-' + index + '-open');
if (!item) {
continue;
}
window.sessionStorage.setItem('sidebar-section-' + sidebarId + '-' + index + '-open', 'false');
}
},
/**
* opens the sidebar
*/
setDefaultContent = function () {
jQuery('body').removeClass('wide-content');
window.sessionStorage.setItem('wide-content', false);
},
/**
* Accessibility helper, focuses the first link witih the given element
*
* @param {jQuery} $elem
*/
focusFirstSubLink = function ($elem) {
$elem.find('a').first().focus();
},
removeOpenStates = function() {
$nav.find('.is-open').removeClass('is-open');
},
/**
* Toggle a navigation panel
*
* @param {jQuery} $toggler The a toggler
*/
toggleNav = function ($toggler) {
var $panel = $toggler.parent().next('div.nav-panel');
var isOpen = $panel.is(':visible');
// open sidebar on interaction
setDefaultContent();
// toggle the panel, focus first link after opening
$panel.dw_toggle(!isOpen, function () {
if (!isOpen) {
focusFirstSubLink($panel);
$toggler.addClass('is-open');
} else {
$toggler.removeClass('is-open');
}
});
window.sessionStorage.setItem('sidebar-section-' + sidebarId + '-' + $toggler.data('index') + '-open', !isOpen);
},
/**
* Initialize the content navigation
*
* It mangles the sidebar content and handles inline Icon configuration
*/
initContentNav = function () {
var $main = $nav.find('nav.nav-main');
if (!$main.length) return;
if(jQuery('body').hasClass('wide-content')) {
removeToggleStorage();
}
var ELEMENT = JSINFO.template.sprintdoc.sidebar_toggle_elements;
var $elements = $main.find(ELEMENT);
$elements.each(function (index) {
var $me = jQuery(this),
// prepare text and the optional icon
data = $me.text().split('@', 2),
text = data[0].trim();
var $icon = jQuery('<span class="ico">')
.text(text.substr(0, 1).toUpperCase() + text.substr(1, 1).toLowerCase())
.wrapInner('<strong>');
if (data[1]) {
var src = data[1].trim();
$icon.load(DOKU_BASE + 'lib/tpl/sprintdoc/svg.php?svg=' + src + '&e=1'); // directly embed
}
// make the new toggler
var $toggler = jQuery('<a>')
.attr('href', '#')
.attr('role', 'heading')
.attr('aria-level', '2')
.text(text)
.wrapInner('<span class="lbl">')
.prepend($icon)
.data('index', index)
;
$toggler = jQuery('<div class="nav">').prepend($toggler);
// wrap all following siblings til the next element in a wrapper
var $wrap = jQuery('<div>')
.addClass('nav-panel');
var $sibs = $me.nextAll();
for (var i = 0; i < $sibs.length; i++) {
var $sib = jQuery($sibs[i]);
if ($sib.is(ELEMENT)) break;
$sib.detach().appendTo($wrap);
addContentMenuCurrentStates($sib, $toggler);
}
/*
* if there is only one subitem with a link, disable toggling
* and use a direct link.
*/
var $links = jQuery($wrap[0]).find('a');
if ($links.length === 1 && $links.first().attr('href') !== '#') {
$toggler.children().first().attr('href', jQuery($links[0]).attr('href'));
} else {
$wrap.insertAfter($me);
if ($toggler.parent('li').length) {
$toggler.parent('li').addClass('toggler');
}
if (window.sessionStorage.getItem('sidebar-section-' + sidebarId + '-' + index + '-open') === 'true') {
$wrap.css('display', 'block');
setTogglerClass($toggler,'is-open');
}
}
// replace element with toggler
$me.replaceWith($toggler);
});
// fade in the navigation (was hidden until now
$main.css({opacity: 0, visibility: "visible"}).animate({opacity: 1}, 200);
},
/**
* Initialize the open/close toggling of menu entries
*/
initMenuHandling = function () {
$nav.on('click', 'div.nav a', function (e) {
if (jQuery(this).attr('href').startsWith('#')) {
toggleNav(jQuery(this));
e.preventDefault();
}
});
},
/**
* adds a given class to the toggler link
* @param $toggler link or parent of link to whom the class is added
* @param classVal class to be added
*/
setTogglerClass = function ($toggler, classVal) {
if($toggler.is('a')) {
$toggler.addClass(classVal);
} else {
$toggler.find('a').addClass(classVal);
}
},
/**
* marks a $toggler link as active if the following menu has an active state
* @param $menuObj jQuery Object of the menu / container
* @param $toggler
*/
addContentMenuCurrentStates = function ($menuObj, $toggler) {
if($menuObj[0] && String($menuObj[0].innerHTML).indexOf('curid') > 0) {
setTogglerClass($toggler,'is-active');
}
},
/**
* Make sure the content area is always as high as the sidebar
*/
initContentMinHeight = function () {
var $sidebar = jQuery('.page-wrapper').find('> .tools').find('.col-xs-12');
if ($sidebar.length == 1) {
var num = parseFloat($sidebar.height());
if (!isNaN(num)) {
jQuery('#dokuwiki__content').css('minHeight', num + 100);
}
}
},
/**
* Initialize the sidebar handle behaviour
*/
initSidebarToggling = function () {
var $toggler = jQuery('.togglelink.page_main-content').find('a');
$toggler.click(function (e) {
e.preventDefault();
if (jQuery('body').hasClass('wide-content')) {
setDefaultContent();
} else {
setWideContent();
removeOpenStates();
}
});
if (window.sessionStorage.getItem('wide-content') === 'true') {
setWideContent();
}
},
/**
* Show sidebar when accessing the search
*/
initSearchToggling = function () {
jQuery('.toggleSearch').find('a').click(function (e) {
setDefaultContent();
e.preventDefault();
jQuery('#qsearch__in').focus();
});
},
/**
* Open and close the sidebar in mobile view
*/
initMobileToggling = function () {
jQuery('.menu-togglelink').find('a').click(function (e) {
e.preventDefault();
var $body = jQuery('body');
$body.toggleClass('show-mobile-sidebar');
});
},
/**
* set is-active class if body has at least one of the given selectors
* @param selectorArray Array of selectors
* @param $nav container in which the $toggler is situated
*/
setActive = function(selectorArray, $nav) {
for(var i=0; i< selectorArray.length; i++) {
var mode = selectorArray[i];
if(jQuery('body').is('.do-'+mode)){
setTogglerClass($nav.find('.nav'),'is-active');
$nav.find('a[href*="do='+mode+'"]').wrapAll('<span class="curid"></span>');
}
}
},
/**
* sets active states in site tool menu and user tool menu for certain modes
* adds sessionStorage behaviour equivalent approach to content menus
*
*/
initTemplateMenues = function () {
var $body = jQuery('body'),
$siteTools = $nav.find('> .nav-sitetools'),
$userTools = $nav.find('> .nav-usermenu'),
$templateMenus = $nav.find('> nav:not(.nav-main)'),
stModes = ['recent', 'media', 'index'],
utModes = ['profile','admin'],
isWideContent = false;
/* set active states for site tool menu and user tool menu */
setActive(stModes,$siteTools);
setActive(utModes,$userTools);
if($body.is('.do-show') && $body.is('.wide-content')) {
window.sessionStorage.setItem('wide-content', true);
isWideContent = true;
}
/* set data attributes for sessionStorage and check onload if one of the template menus should be opened */
$templateMenus.each(function( index ) {
var $t = jQuery(this).find('.nav'),
y = $nav.find('.nav-main').find('.nav').length,
$toggler = ($t.is('a')) ? $t : $t.find('a:last'),
tIndex = y + index;
$toggler.data('index', tIndex);
var item = window.sessionStorage.getItem('sidebar-section-' + sidebarId + '-' + tIndex + '-open');
if (item) {
if(isWideContent) {
window.sessionStorage.setItem('sidebar-section-' + sidebarId + '-' + tIndex + '-open', 'false');
} else {
if (item === 'true') {
jQuery(this).find('.nav-panel').css('display', 'block');
setTogglerClass($toggler, 'is-open');
}
}
}
//console.log(window.sessionStorage);
});
};
// main
initContentNav();
initSidebarToggling();
initTemplateMenues();
initMenuHandling();
initContentMinHeight();
initSearchToggling();
initMobileToggling();
});