Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Initial commit of Fossil to Git build.
Browse files Browse the repository at this point in the history
  • Loading branch information
roma0104 committed Sep 25, 2014
0 parents commit 79518e1
Show file tree
Hide file tree
Showing 69 changed files with 1,852 additions and 0 deletions.
21 changes: 21 additions & 0 deletions core/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Roma Quintin Hicks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions core/images/bin.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/rubbishbin
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M3 0c-.55 0-1 .45-1 1h-1c-.55 0-1 .45-1 1h7c0-.55-.45-1-1-1h-1c0-.55-.45-1-1-1h-1zm-2 3v4.81c0 .11.08.19.19.19h4.63c.11 0 .19-.08.19-.19v-4.81h-1v3.5c0 .28-.22.5-.5.5s-.5-.22-.5-.5v-3.5h-1v3.5c0 .28-.22.5-.5.5s-.5-.22-.5-.5v-3.5h-1z" /></svg>
5 changes: 5 additions & 0 deletions core/images/briefcase.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/plugins/briefcase/core/images/briefcase
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="10pt" height="10pt" viewBox="0 0 8 8"><path d="M3 0c-.55 0-1 .45-1 1v1h-1.91c-.06 0-.09.04-.09.09v2.41c0 .28.22.5.5.5h7c.28 0 .5-.22.5-.5v-2.41c0-.06-.04-.09-.09-.09h-1.91v-1c0-.55-.45-1-1-1h-2zm0 1h2v1h-2v-1zm-3 4.91v2c0 .05.04.09.09.09h7.81c.05 0 .09-.04.09-.09v-2c-.16.06-.32.09-.5.09h-7c-.18 0-.34-.04-.5-.09z"
/></svg>
4 changes: 4 additions & 0 deletions core/images/clock.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/clock
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="10pt" height="10pt" viewBox="0 0 8 8"><path d="M4 0c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 1c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm-.5 1v2.22l.16.13.5.5.34.38.72-.72-.38-.34-.34-.34v-1.81h-1z" /></svg>
4 changes: 4 additions & 0 deletions core/images/contact.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/contact
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="10pt" height="10pt" viewBox="0 0 8 8"><path d="M4 0c-1.1 0-2 1.12-2 2.5s.9 2.5 2 2.5 2-1.12 2-2.5-.9-2.5-2-2.5zm-2.09 5c-1.06.05-1.91.92-1.91 2v1h8v-1c0-1.08-.84-1.95-1.91-2-.54.61-1.28 1-2.09 1-.81 0-1.55-.39-2.09-1z" /></svg>
4 changes: 4 additions & 0 deletions core/images/dashboard.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/dashboard
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M4 0c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 1c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 1c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-1.66 1a.5.5 0 0 0-.19.84l.91.91c-.02.08-.06.16-.06.25 0 .55.45 1 1 1s1-.45 1-1-.45-1-1-1c-.09 0-.17.04-.25.06l-.91-.91a.5.5 0 0 0-.44-.16.5.5 0 0 0-.06 0zm3.16 0c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5z"/></svg>
4 changes: 4 additions & 0 deletions core/images/download.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/download
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M3 0v3h-2l3 3 3-3h-2v-3h-2zm-3 7v1h8v-1h-8z" /></svg>
5 changes: 5 additions & 0 deletions core/images/globe.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/plugins/briefcase/core/images/globe
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M4 0c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 1c.33 0 .64.09.94.19-.21.2-.45.38-.41.56.04.18.69.13.69.5 0 .27-.42.35-.13.66.35.35-.64.98-.66 1.44-.03.83.84.97 1.53.97.42 0 .53.2.5.44-.54.77-1.46 1.25-2.47 1.25-.38 0-.73-.09-1.06-.22.22-.44-.28-1.31-.75-1.59-.23-.23-.72-.14-1-.25-.09-.27-.18-.54-.19-.84.03-.05.08-.09.16-.09.19 0 .45.38.59.34.18-.04-.74-1.31-.31-1.56.2-.12.6.39.47-.16-.12-.51.36-.28.66-.41.26-.11.45-.41.13-.59-.06-.03-.13-.1-.22-.19.45-.27.97-.44 1.53-.44zm2.31 1.09c.18.22.32.46.44.72 0 .01 0 .02 0 .03-.04.07-.11.11-.22.22-.28.28-.32-.21-.44-.31-.13-.12-.6.02-.66-.13-.07-.18.5-.42.88-.53z"
/></svg>
4 changes: 4 additions & 0 deletions core/images/note.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/excerpt
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="10pt" height="10pt" viewBox="0 0 8 8"><path d="M.09 0c-.06 0-.09.04-.09.09v5.81c0 .05.04.09.09.09h5.91l2 2v-7.91c0-.06-.04-.09-.09-.09h-7.81z" /></svg>
4 changes: 4 additions & 0 deletions core/images/project.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/project
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M0 0v7h1v-7h-1zm7 0v7h1v-7h-1zm-5 1v1h2v-1h-2zm1 2v1h2v-1h-2zm1 2v1h2v-1h-2z" /></svg>
4 changes: 4 additions & 0 deletions core/images/reference.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/reference
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="10pt" height="10pt" viewBox="0 0 8 8"><path d="M1 0c-.07 0-.13.01-.19.03-.39.08-.7.39-.78.78-.03.06-.03.12-.03.19v5.5c0 .83.67 1.5 1.5 1.5h5.5v-1h-5.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h5.5v-5.5c0-.28-.22-.5-.5-.5h-.5v3l-1-1-1 1v-3h-3z" /></svg>
4 changes: 4 additions & 0 deletions core/images/task.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/plugins/briefcase/core/images/task
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M0 0v7h7v-3.59l-1 1v1.59h-5v-5h3.59l1-1h-5.59zm7 0l-3 3-1-1-1 1 2 2 4-4-1-1z" /></svg>
5 changes: 5 additions & 0 deletions core/images/wrench.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/plugins/briefcase/core/images/wrench
tags: $:/tags/Image

<svg class="tc-image-home-button tc-image-button" width="22pt" height="22pt" viewBox="0 0 8 8"><path d="M5.5 0c-1.38 0-2.5 1.12-2.5 2.5 0 .32.08.62.19.91l-2.91 2.88c-.39.39-.39 1.05 0 1.44.2.2.46.28.72.28.26 0 .52-.09.72-.28l2.88-2.91c.28.11.58.19.91.19 1.38 0 2.5-1.12 2.5-2.5 0-.16 0-.32-.03-.47l-.97.97h-2v-2l.97-.97c-.15-.03-.31-.03-.47-.03zm-4.5 6.5c.28 0 .5.22.5.5s-.22.5-.5.5-.5-.22-.5-.5.22-.5.5-.5z"
/></svg>
67 changes: 67 additions & 0 deletions core/modules/filters/datefilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*\
title: $:/plugins/briefcase/core/modules/filters/datefilter.js
type: application/javascript
module-type: filteroperator
Filter operator for comparing date with date field.
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Export our filter function
*/
exports.date = function(source,operator,options) {
var results = [],
fieldname = (operator.suffix || "created").toLowerCase();
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(tiddler) {
var field_string = tiddler.getFieldString(fieldname);
var field_object = $tw.utils.parseDate(field_string);
if(operator.operand.split("-").length === 1) {
var now = new Date();
now.setUTCHours(0);
now.setUTCMinutes(0);
now.setUTCSeconds(0);
now.setUTCMilliseconds(0);
var offsetDays = parseInt(operator.operand)*86400000;
var test_object = new Date(now-offsetDays);
} else {
var test_object = new Date(operator.operand);
}
if(isNaN(field_object.valueOf()) === false && isNaN(test_object.valueOf()) === false && field_object <= test_object) {
results.push(title);
}
}
});
} else {
source(function(tiddler,title) {
if(tiddler) {
var field_string = tiddler.getFieldString(fieldname);
var field_object = $tw.utils.parseDate(field_string);
if(operator.operand.split("-").length === 1) {
var now = new Date();
now.setUTCHours(0);
now.setUTCMinutes(0);
now.setUTCSeconds(0);
now.setUTCMilliseconds(0);
var offsetDays = parseInt(operator.operand)*86400000
var test_object = new Date(now-offsetDays);
} else {
var test_object = new Date(operator.operand);
}
if(isNaN(field_object.valueOf()) === false && isNaN(test_object.valueOf()) === false && field_object >= test_object) {
results.push(title);
}
}
});
}
return results;
};

})();
44 changes: 44 additions & 0 deletions core/modules/startup/tickler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*\
title: $:/plugins/briefcase/core/modules/startup/tickler.js
type: application/javascript
module-type: startup
Tickler alert manager.
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

// Export name and synchronous status
exports.name = "tickler";
//exports.platforms = ["browser"];
exports.after = ["story"];
exports.synchronous = true;

exports.startup = function() {
$tw.wiki.forEachTiddler(checkForAlert);
var interval = setInterval(function() {
$tw.wiki.forEachTiddler(checkForAlert);
}, 3600000);
};

function checkForAlert(title, tiddler) {
var now = new Date();
if(!tiddler) {
return;
}
if(tiddler.fields.gtd_type === "tickler") {
if(tiddler.fields.gtd_tickdate) {
var alert_date = $tw.utils.parseDate(tiddler.fields.gtd_tickdate);
if(alert_date <= now) {
this.setText(title, "component", null, tiddler.fields.title);
this.setText(title, "tags", null, "$:/tags/Alert");
}
}
}
}

})();
124 changes: 124 additions & 0 deletions core/modules/widgets/action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*\
title: $:/plugins/briefcase/core/modules/widgets/action.js
type: application/javascript
module-type: widget
New Action Widget
\*/
(function() {

// jslint node: true, browser: true
// global $tw: false
"use_strict";

var Widget = require("$:/core/modules/widgets/widget.js").widget;

var ActionWidget = function(parseTreeNode, options) {
this.initialise(parseTreeNode, options);
};

// Inherit from Widget
ActionWidget.prototype = new Widget();

// Render to DOM
ActionWidget.prototype.render = function(parent, nextSibling) {
var self = this;
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
// Create DOM element
var domNode = this.document.createElement("button");
domNode.className = this["class"];
if(this.title) {
domNode.setAttribute("title", this.title);
}
if(this["aria-label"]) {
domNode.setAttribute("aria-label", this["aria-label"]);
}
// Add event listener
domNode.addEventListener(
"click",
function(event) {
self.handleClick(event);
},
false
);
// Insert element
parent.insertBefore(domNode, nextSibling);
this.renderChildren(domNode, null);
this.domNodes.push(domNode);
};

ActionWidget.prototype.handleClick = function(event) {
var title = prompt("Enter title:");
if(!title) {
return;
}
/*
Special thanks to Stephan "Skeeve" Hradek for the NewTiddler plugin.
Much of the following code is pulled from his plugin.
http://tiddlystuff.tiddlyspot.com
*/

var skeleton = this.wiki.getTiddlerAsJson(this.newtiddlerSkeleton);
var skeletonClone = JSON.parse(this.substituteVariableReferences(skeleton));
var basetitle = title;
var newTitle = basetitle;
for(var t=1; this.wiki.tiddlerExists(newTitle); t++) {
newTitle = basetitle + " " + t;
}
skeletonClone.title = newTitle;
var created = this.wiki.getCreationFields();
for(var creationField in created) {
skeletonClone[creationField] = created[creationField];
}
var modified = this.wiki.getModificationFields();
for(var modificationField in modified) {
skeletonClone[modificationField] = modified[modificationField];
}
this.wiki.addTiddler(skeletonClone);
switch(this.newtiddlerEdit) {
case "show":
case "yes":
var bounds = this.domNodes[0].getBoundingClientRect();
this.dispatchEvent({
type: "tm-navigate",
navigateTo: newTitle,
navigateFromTitle: this.getVariable("currentTiddler"),
navigateFromNode: this,
navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height
}
});
if(this.newtiddlerEdit === "yes") {
this.dispatchEvent({type: "tm-edit-tiddler", tiddlerTitle: newTitle});
}
break;
case "no":
break;
}

};

ActionWidget.prototype.execute = function() {
// Get attributes
this["class"] = this.getAttribute("class", "");
this["aria-label"] = this.getAttribute("aria-label");
this.title = this.getAttribute("title");
this.newtiddlerSkeleton = this.getAttribute("skeleton");
this.newtiddlerEdit = this.getAttribute("edit", "show");
this.makeChildWidgets();
};

ActionWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes["class"]) {
this.refreshSelf();
return true;
}
return this.refreshChildren(changedTiddlers);
};

exports.action = ActionWidget;

})();
Loading

0 comments on commit 79518e1

Please sign in to comment.