Compare commits
3 commits
fe8008c5b5
...
9ce027285c
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ce027285c | |||
| 7912b002a2 | |||
| 9696442a91 |
3 changed files with 135 additions and 138 deletions
162
.jshintrc
162
.jshintrc
|
|
@ -1,93 +1,74 @@
|
|||
{
|
||||
// JSHint Default Configuration File (as on JSHint website)
|
||||
// See http://jshint.com/docs/ for more details
|
||||
|
||||
"maxerr" : 50, // {int} Maximum error before stopping
|
||||
|
||||
// Enforcing
|
||||
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
||||
"camelcase" : false, // true: Identifiers must be in camelCase
|
||||
"curly" : false, // true: Require {} for every new block or scope
|
||||
"eqeqeq" : true, // true: Require triple equals (===) for comparison
|
||||
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
|
||||
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
|
||||
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
|
||||
"latedef" : true, // true: Require variables/functions to be defined before being used
|
||||
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
|
||||
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
||||
"noempty" : true, // true: Prohibit use of empty blocks
|
||||
"nonbsp" : true, // true: Prohibit `non-breaking whitespace` characters.
|
||||
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
|
||||
"plusplus" : false, // true: Prohibit use of `++` and `--`
|
||||
"quotmark" : true, // Quotation mark consistency:
|
||||
// false : do nothing (default)
|
||||
// true : ensure whatever is used is consistent
|
||||
// "single" : require single quotes
|
||||
// "double" : require double quotes
|
||||
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
||||
"unused" : true, // Unused variables:
|
||||
// true : all variables, last function parameter
|
||||
// "vars" : all variables only
|
||||
// "strict" : all variables, all function parameters
|
||||
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
|
||||
"maxparams" : false, // {int} Max number of formal params allowed per function
|
||||
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
||||
"maxstatements" : false, // {int} Max number statements per function
|
||||
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
||||
"maxlen" : false, // {int} Max number of characters per line
|
||||
"varstmt" : false, // true: Disallow any var statements. Only `let` and `const` are allowed.
|
||||
|
||||
// Relaxing
|
||||
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
||||
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
||||
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
||||
"eqnull" : false, // true: Tolerate use of `== null`
|
||||
"esversion" : 9, // {int} Specify the ECMAScript version to which the code must adhere.
|
||||
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
|
||||
// (ex: `for each`, multiple try/catch, function expression…)
|
||||
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
||||
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
||||
"funcscope" : false, // true: Tolerate defining variables inside control statements
|
||||
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
||||
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
||||
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
||||
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
||||
"laxcomma" : false, // true: Tolerate comma-first style coding
|
||||
"loopfunc" : false, // true: Tolerate functions being defined in loops
|
||||
"multistr" : false, // true: Tolerate multi-line strings
|
||||
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
|
||||
"notypeof" : false, // true: Tolerate invalid typeof operator values
|
||||
"proto" : false, // true: Tolerate using the `__proto__` property
|
||||
"scripturl" : false, // true: Tolerate script-targeted URLs
|
||||
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
||||
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
||||
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
||||
"validthis" : false, // true: Tolerate using this in a non-constructor function
|
||||
|
||||
// Environments
|
||||
"browser" : true, // Web Browser (window, document, etc)
|
||||
"browserify" : false, // Browserify (node.js code in the browser)
|
||||
"couch" : false, // CouchDB
|
||||
"devel" : true, // Development/debugging (alert, confirm, etc)
|
||||
"dojo" : false, // Dojo Toolkit
|
||||
"jasmine" : false, // Jasmine
|
||||
"jquery" : true, // jQuery
|
||||
"mocha" : true, // Mocha
|
||||
"mootools" : false, // MooTools
|
||||
"node" : false, // Node.js
|
||||
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
|
||||
"phantom" : false, // PhantomJS
|
||||
"prototypejs" : false, // Prototype and Scriptaculous
|
||||
"qunit" : false, // QUnit
|
||||
"rhino" : false, // Rhino
|
||||
"shelljs" : false, // ShellJS
|
||||
"typed" : false, // Globals for typed array constructions
|
||||
"worker" : false, // Web Workers
|
||||
"wsh" : false, // Windows Scripting Host
|
||||
"yui" : false, // Yahoo User Interface
|
||||
|
||||
// Custom globals
|
||||
"globals" : { // additional predefined global variables
|
||||
"maxerr": 50,
|
||||
"bitwise": true,
|
||||
"camelcase": false,
|
||||
"curly": false,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"freeze": true,
|
||||
"immed": false,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonbsp": true,
|
||||
"nonew": false,
|
||||
"plusplus": false,
|
||||
"quotmark": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"maxparams": false,
|
||||
"maxdepth": false,
|
||||
"maxstatements": false,
|
||||
"maxcomplexity": false,
|
||||
"maxlen": false,
|
||||
"varstmt": false,
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": false,
|
||||
"esversion": 9,
|
||||
"moz": false,
|
||||
"evil": false,
|
||||
"expr": false,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": false,
|
||||
"laxcomma": false,
|
||||
"loopfunc": false,
|
||||
"multistr": false,
|
||||
"noyield": false,
|
||||
"notypeof": false,
|
||||
"proto": false,
|
||||
"scripturl": false,
|
||||
"shadow": false,
|
||||
"sub": false,
|
||||
"supernew": false,
|
||||
"validthis": false,
|
||||
"browser": true,
|
||||
"browserify": false,
|
||||
"couch": false,
|
||||
"devel": true,
|
||||
"dojo": false,
|
||||
"jasmine": false,
|
||||
"jquery": true,
|
||||
"mocha": true,
|
||||
"mootools": false,
|
||||
"node": false,
|
||||
"nonstandard": false,
|
||||
"phantom": false,
|
||||
"prototypejs": false,
|
||||
"qunit": false,
|
||||
"rhino": false,
|
||||
"shelljs": false,
|
||||
"typed": false,
|
||||
"worker": false,
|
||||
"wsh": false,
|
||||
"yui": false,
|
||||
"globals": {
|
||||
"debugOn": true,
|
||||
"hippie": true,
|
||||
"viewHover": true,
|
||||
|
|
@ -95,7 +76,8 @@
|
|||
"TimeDisplay": true,
|
||||
"DateDisplay": true,
|
||||
"checkButtonAndTarget": true,
|
||||
"getClosestEdge": true,
|
||||
"getClosestEdgeToElement": true,
|
||||
"getClosestEdgeToMouse": true,
|
||||
"centerElementUnderCursor": true,
|
||||
"setAttributesAccordingToPosition": true,
|
||||
"HippieTaskBar": true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// TODO: Inhalte angleichen nach Zusammenfassung von app.js und function.js.
|
||||
// Bennung und Beschreibungen verbessern.
|
||||
// Benennung und Beschreibungen verbessern.
|
||||
|
||||
// This is called everytime
|
||||
function setup() {
|
||||
|
|
@ -56,7 +56,7 @@ function HippieScroll($tp, $dn) {
|
|||
});
|
||||
$dn.click(function (event) {
|
||||
event.preventDefault();
|
||||
var pos = Math.max(hippie.screen.dh, hippie.body.h) - hippie.screen.vh;
|
||||
const pos = Math.max(hippie.screen.dh, hippie.body.h) - hippie.screen.vh;
|
||||
$('html').scrollTop(pos);
|
||||
// document.documentElement.scrollTop = pos;
|
||||
console.info('Scrolled down to', pos);
|
||||
|
|
@ -91,7 +91,7 @@ function HippieMeta($ma, $pp) {
|
|||
let metaOn = false;
|
||||
|
||||
$ma.click(function () {
|
||||
var $wrap, $pop;
|
||||
const $wrap, $pop;
|
||||
|
||||
// if (metaOn !== true) {
|
||||
if (!metaOn) {
|
||||
|
|
@ -162,23 +162,25 @@ function HippieMeta($ma, $pp) {
|
|||
|
||||
// Sets the href attribute to mailto: with given information
|
||||
function composeMail(tag, name, prov, suffix, text, topic) {
|
||||
let trigger = tag.indexOf(".");
|
||||
'use strict';
|
||||
|
||||
let trigger = tag.indexOf('.');
|
||||
let mailString = name + '@' + prov + '.' + suffix;
|
||||
let textString = mailString.replace(/@/g, "(at)");
|
||||
let descString = "Nachricht an " + mailString;
|
||||
let textString = mailString.replace(/@/g, '(at)');
|
||||
let descString = 'Nachricht an ' + mailString;
|
||||
|
||||
if (!text) {
|
||||
text = mailString;
|
||||
} else if (text === "at") {
|
||||
} else if (text === 'at') {
|
||||
text = textString;
|
||||
} else if (text === "to") {
|
||||
} else if (text === 'to') {
|
||||
text = descString;
|
||||
}
|
||||
|
||||
if (topic) {
|
||||
topic = "?subject=" + topic;
|
||||
topic = '?subject=' + topic;
|
||||
} else {
|
||||
topic = "";
|
||||
topic = '';
|
||||
}
|
||||
|
||||
if (trigger === -1) {
|
||||
|
|
@ -186,7 +188,7 @@ function composeMail(tag, name, prov, suffix, text, topic) {
|
|||
const elContent = el.innerHTML;
|
||||
|
||||
el.innerHTML = elContent + text;
|
||||
el.setAttribute("href", "mailto:" + mailString + topic);
|
||||
el.setAttribute('href', 'mailto:' + mailString + topic);
|
||||
} else {
|
||||
const els = document.getElementsByClassName(tag.slice(1));
|
||||
|
||||
|
|
@ -194,7 +196,7 @@ function composeMail(tag, name, prov, suffix, text, topic) {
|
|||
const elContent = el.innerHTML;
|
||||
|
||||
el.innerHTML = elContent + text;
|
||||
el.setAttribute("href", "mailto:" + mailString + topic);
|
||||
el.setAttribute('href', 'mailto:' + mailString + topic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -346,21 +348,40 @@ function checkButtonAndTarget(event, element, button = 0) {
|
|||
);
|
||||
}
|
||||
|
||||
function getClosestEdge(element) {
|
||||
function getClosestEdgeToElement(element) {
|
||||
'use strict';
|
||||
|
||||
const rect = element.getBoundingClientRect();
|
||||
const windowWidth = window.innerWidth;
|
||||
const windowHeight = window.innerHeight;
|
||||
const distances = {
|
||||
top: rect.top,
|
||||
right: windowWidth - rect.right,
|
||||
bottom: windowHeight - rect.bottom,
|
||||
right: window.innerWidth - rect.right,
|
||||
bottom: window.innerHeight - rect.bottom,
|
||||
left: rect.left
|
||||
};
|
||||
|
||||
return Object.keys(distances).reduce((a, b) => distances[a] < distances[b] ? a : b);
|
||||
}
|
||||
|
||||
function getClosestEdgeToMouse(event) {
|
||||
'use strict';
|
||||
|
||||
const mouseX = event.clientX;
|
||||
const mouseY = event.clientY;
|
||||
const distances = {
|
||||
left: mouseX,
|
||||
right: window.innerWidth - mouseX,
|
||||
top: mouseY,
|
||||
bottom: window.innerHeight - mouseY
|
||||
};
|
||||
|
||||
return Object.keys(distances).reduce((a, b) =>
|
||||
distances[a] < distances[b] ? a : b
|
||||
);
|
||||
}
|
||||
|
||||
function centerElementUnderCursor(event, element) {
|
||||
'use strict';
|
||||
|
||||
const offsetX = element.getBoundingClientRect().width / 2;
|
||||
const offsetY = element.getBoundingClientRect().height / 2;
|
||||
const x = event.clientX - offsetX;
|
||||
|
|
@ -371,6 +392,8 @@ function centerElementUnderCursor(event, element) {
|
|||
}
|
||||
|
||||
function setAttributesAccordingToPosition(element, position, attributes) {
|
||||
'use strict';
|
||||
|
||||
element.classList.remove(...Object.values(attributes).map(pos => pos.className));
|
||||
Object.keys(attributes[position].styles).forEach(key => {
|
||||
element.style[key] = '';
|
||||
|
|
@ -440,17 +463,15 @@ Clock.prototype.formatDigits = function (val) {
|
|||
return val;
|
||||
};
|
||||
|
||||
var floor = Math.floor;
|
||||
|
||||
function ongoing() {
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var w = Math.floor(now.getDay());
|
||||
var D = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
|
||||
var D = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
|
||||
var DNumb = Math.floor(now.getDate());
|
||||
var MNumb = Math.floor(now.getMonth());
|
||||
var M = new Array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
|
||||
var M = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'MaiOktober', 'November', 'Dezember'];
|
||||
var y = Math.floor(now.getYear());
|
||||
if (y < 999) y += 1900;
|
||||
|
||||
|
|
@ -501,23 +522,22 @@ function ongoing() {
|
|||
var moonPosX = 0;
|
||||
var moonPosY = 0;
|
||||
|
||||
var sun = $("#sun").css({
|
||||
"left": (s / 60) * travelWidth,
|
||||
"top": (m / 60) * travelHeight
|
||||
var sun = $('#sun').css({
|
||||
'left': (s / 60) * travelWidth,
|
||||
'top': (m / 60) * travelHeight
|
||||
});
|
||||
|
||||
$("#day").text(D[w]);
|
||||
$("#dayNumb").text(DNumb);
|
||||
$("#month").text(M[MNumb]);
|
||||
$("#year").text(y);
|
||||
$("#time").text('' + zeroFill(h, 2) + ':' + zeroFill(m, 2) + ':' + zeroFill(s, 2));
|
||||
|
||||
$("#julian").text(jd.toFixed(6));
|
||||
//$("#star").text(stH + ':' + stM + ':' + stS);
|
||||
$("#star").text(stH + ':' + stM);
|
||||
$("#star1").text(stGMT);
|
||||
$("#star2").text(stGMT2);
|
||||
$('#day').text(D[w]);
|
||||
$('#dayNumb').text(DNumb);
|
||||
$('#month').text(M[MNumb]);
|
||||
$('#year').text(y);
|
||||
$('#time').text('' + zeroFill(h, 2) + ':' + zeroFill(m, 2) + ':' + zeroFill(s, 2));
|
||||
|
||||
$('#julian').text(jd.toFixed(6));
|
||||
//$('#star').text(stH + ':' + stM + ':' + stS);
|
||||
$('#star').text(stH + ':' + stM);
|
||||
$('#star1').text(stGMT);
|
||||
$('#star2').text(stGMT2);
|
||||
}
|
||||
|
||||
function zeroFill(number, width) {
|
||||
|
|
@ -525,7 +545,7 @@ function zeroFill(number, width) {
|
|||
if (width > 0) {
|
||||
return new Array(width + (/\./.test(number) ? 2 : 1)).join('0') + number;
|
||||
}
|
||||
return number + ""; // always return a string
|
||||
return number + ''; // always return a string
|
||||
}
|
||||
|
||||
//Länge der Balken im Diagram berechnen
|
||||
|
|
@ -545,7 +565,7 @@ String.prototype.transform = function () {
|
|||
}
|
||||
//Array Element erweitern
|
||||
Array.prototype.arrayAdd = function () {
|
||||
return eval(this.join("+"));
|
||||
return eval(this.join('+'));
|
||||
}
|
||||
|
||||
//Speicherplatz in Prozent berechnen
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class HippieTaskBar {
|
|||
// TODO: Erweitern auf allgemeine Möglichkeiten und dann aus JSON-Datei laden
|
||||
this.options = options || {
|
||||
direction: 0,
|
||||
position: 'bottom',
|
||||
date: {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
|
|
@ -30,7 +31,7 @@ class HippieTaskBar {
|
|||
this.element.querySelector('.clock').appendChild(dateElement);
|
||||
this.date = new DateDisplay(dateElement, this.options.date);
|
||||
|
||||
this.setOptions('bottom');
|
||||
this.setOptions(this.options.position);
|
||||
}
|
||||
|
||||
onMouseDown(event) {
|
||||
|
|
@ -49,9 +50,7 @@ class HippieTaskBar {
|
|||
|
||||
onMouseMove(event) {
|
||||
if (this.isDragging) {
|
||||
if (!this.isDragging) return;
|
||||
|
||||
const closestEdge = getClosestEdge(this.placeholder);
|
||||
this.options.position = getClosestEdgeToMouse(event);
|
||||
const borderRadius = '4px';
|
||||
const attributes = {
|
||||
top: {
|
||||
|
|
@ -112,7 +111,7 @@ class HippieTaskBar {
|
|||
}
|
||||
};
|
||||
|
||||
setAttributesAccordingToPosition(this.placeholder, closestEdge, attributes);
|
||||
setAttributesAccordingToPosition(this.placeholder, this.options.position, attributes);
|
||||
centerElementUnderCursor(event, this.placeholder);
|
||||
}
|
||||
}
|
||||
|
|
@ -121,7 +120,6 @@ class HippieTaskBar {
|
|||
if (event.target === this.placeholder) {
|
||||
console.debug('Drag mode disabled');
|
||||
|
||||
if (!this.isDragging) return;
|
||||
this.isDragging = false;
|
||||
|
||||
this.snapToEdges();
|
||||
|
|
@ -139,11 +137,8 @@ class HippieTaskBar {
|
|||
this.element.style.display = '';
|
||||
}
|
||||
|
||||
// TODO: Prüfung auf Ziel auslagern und schon bei Mausbewegung verfügbar machen
|
||||
snapToEdges() {
|
||||
const closestEdge = getClosestEdge(this.placeholder);
|
||||
|
||||
this.setOptions(closestEdge);
|
||||
this.setOptions(this.options.position);
|
||||
this.date.changeFormat(this.options.date, this.options.direction);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue