Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
/***
|''Name:''|404Plugin|
|''Description:''||
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#404Plugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0 pre-release|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
*
***/
// /%
//!BEGIN-PLUGIN-CODE
config.views.wikified.defaultText= "{{fourohfour{\nThe page '%0' doesn't exist.\n\n Try browsing or searching for what you were looking for.\n}}}";
setStylesheet(".fourohfour {text-align:center; font-family:'Lucida Grande', Verdana, Sans-Serif; font-size:1.2em; font-weight:bold; font-style:normal;}","404Styles");
//!END-PLUGIN-CODE
// %/
/***
|''Name:''|ActiveMenuLinksPlugin|
|''Description:''||
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#ActiveMenuLinksPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0 pre-release|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
*
***/
// /%
//!BEGIN-PLUGIN-CODE
Story.prototype.refreshTiddler_activelink = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function (title,template,force)
{
var theTiddler = Story.prototype.refreshTiddler_activelink.apply(this,arguments);
if (!theTiddler)
return theTiddler;
this.highlightActiveLinks();
return theTiddler;
}
Story.prototype.highlightActiveLinks = function()
{
var menu = document.getElementById("menucontent");
var links = menu.getElementsByTagName("a");
for (var i=0; i<links.length; i++){
if (!links[i].getAttribute("tiddlyLink"))
return;
if (document.getElementById(this.idPrefix+(links[i].getAttribute("tiddlylink"))))
addClass(links[i],"activeLink");
else
removeClass(links[i],"activeLink");
}
}
Story.prototype.closeTiddler_activelink = Story.prototype.closeTiddler;
Story.prototype.closeTiddler = function(title,animate,unused)
{
this.closeTiddler_activelink.apply(this,arguments);
this.highlightActiveLinks();
}
//!END-PLUGIN-CODE
// %/
<!--
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
-->
<!--{{{-->
<div id="stickybod">
<div id="headerWrap">
<div id="header">
<span id='searchbar' macro='search "Search: type, then press enter"'></span>
<div id="headerTitle" refresh='content' tiddler='SiteTitle'></div>
</div>
</div>
<div id="mainWrap">
<div id="main">
<div id='menu'>
<div id='menucontent' refresh='content' tiddler='MainMenu'></div>
<div id='mysidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabsWrapper'></div>
</div>
</div>
<div id='mydisplayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
</div>
<br class='clear-float'/>
</div>
<div id="push"></div>
</div>
<div id="stickyfoot">
<div id="footer" refresh='content' force='true' tiddler='Footer'>
</div>
</div>
<!--}}}-->
! Constants
The RAM used by the poker server during the tests never exceeds ''150MB''.
A hand uses an average 3KB of database disk space.
A user profile uses an average of 2KB of database disk space.
! 3,000 players
|[img[Hands per minute|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day.png]]<<imagebox>>|[img[Players|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day.png]]<<imagebox>>|[img[Entropy|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day.png]]<<imagebox>>|[img[CPU|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day.png]]<<imagebox>>|
|417 Hands/minute|2,640 players|3273B entropy|100% CPU|
|[img[Network usage|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day.png]]<<imagebox>>|[img[MySQL queries|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day-small.png][results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day.png]]<<imagebox>>|
|Net 2KB/s in, 52KB/s out|185 queries/sec|
[[additional resources graphs|results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info.html]]
! 6,000 players
|[img[Hands per minute|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day.png]]<<imagebox>>|[img[Players|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day.png]]<<imagebox>>|[img[Entropy|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day.png]]<<imagebox>>|[img[CPU|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day.png]]<<imagebox>>|
|394 Hands/minute|5,300 players|1680B entropy|100% CPU|
|[img[Network usage|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day.png]]<<imagebox>>|[img[MySQL queries|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day-small.png][results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day.png]]<<imagebox>>|
|Net 2KB/s in, 70KB/s out|190 queries/sec|
[[additional resources graphs|results/var/www/stats-6000/pokersource.info/poker-network-1-2-0.pokersource.info.html]]
! 10,000 players
|[img[Hands per minute|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_hands_localhost-day.png]]<<imagebox>>|[img[Players|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_players_localhost-day.png]]<<imagebox>>|[img[Entropy|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-entropy-day.png]]<<imagebox>>|[img[CPU|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day.png]]<<imagebox>>|
|420 Hands/minute|4,730 players|3000B entropy|100% CPU|
|[img[Network usage|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-poker_traffic_localhost-day.png]]<<imagebox>>|[img[MySQL queries|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day-small.png][results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info-mysql_queries-day.png]]<<imagebox>>|
|Net 2KB/s in, 70KB/s out|190 queries/sec|
[[additional resources graphs|results/var/www/stats-10000/pokersource.info/poker-network-1-2-0.pokersource.info.html]]
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
Background: #fff
Foreground: #000
PrimaryPale: #BBF471
PrimaryLight: #75C20F
PrimaryMid: #01752E
PrimaryDark: #222
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #01752E
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
A single server accepts a maximum of ''4,000 players'' playing an average of 60 hands per hour without performance loss. During tests the server accepted a maximum of ''5,300 players'' playing an average of 45 hands per hour and player being occasionaly disconnected because of response time delays.
For a poker server running on 3.2GHz Xeon processor, ''the limiting factor is the CPU''.
The server uses less than 150MB RAM and requires less than 100KB/s network bandwidth. The database was never stressed over 200 requests per second for a total of transported data lower than 100KB/s. The entropy source never dried, despite the lack of dedicated hardware.
Save for the CPU, alll these upper limits are satisfied with low end hardware.
[[Conclusions]]
[[Analysis]]
Content © Loic Dachary 2007 | powered by [[TiddlyWiki|http://tiddlywiki.com]] | [[JoshuaTheme]] © [[Lewcid|http://tw.lewcid.org]] 2007
/***
|''Name:''|GenerateRssByTagPlugin|
|''Description:''|Only tiddlers with a specific tag are inluded in the RSSFeed. If no tiddlers are selected then works as before. (see ticket #270: http://trac.tiddlywiki.org/tiddlywiki/ticket/270). <br>RssTag: <<option txtRssTag>>|
|''Version:''|1.0.3|
|''Date:''|May 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#GenerateRssByTagPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.GenerateRssByTagPlugin = {
major: 1, minor: 0, revision: 3,
date: new Date("May 17, 2007"),
source: 'http://tiddlywiki.bidix.info/#GenerateRssByTagPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0 (Beta 5)'
};
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.generateRssByTag = function()
{
var s = [];
var d = new Date();
var u = store.getTiddlerText("SiteUrl");
// Assemble the header
s.push("<" + "?xml version=\"1.0\"" + " encoding='UTF-8' " + "?" + ">");
s.push("<rss version=\"2.0\">");
s.push("<channel>");
s.push("<title" + ">" + wikifyPlain("SiteTitle").htmlEncode() + "</title" + ">");
if(u)
s.push("<link>" + u.htmlEncode() + "</link>");
s.push("<description>" + wikifyPlain("SiteSubtitle").htmlEncode() + "</description>");
s.push("<language>en-us</language>");
s.push("<copyright>Copyright " + d.getFullYear() + " " + config.options.txtUserName.htmlEncode() + "</copyright>");
s.push("<pubDate>" + d.toGMTString() + "</pubDate>");
s.push("<lastBuildDate>" + d.toGMTString() + "</lastBuildDate>");
s.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>");
s.push("<generator>TiddlyWiki " + version.major + "." + version.minor + "." + version.revision + "</generator>");
// The body
var tiddlers;
if (config.options.txtRssTag && store.getTaggedTiddlers(config.options.txtRssTag).length > 0)
tiddlers = store.getTaggedTiddlers(config.options.txtRssTag,"modified");
else
tiddlers = store.getTiddlers("modified","excludeLists");
var n = config.numRssItems > tiddlers.length ? 0 : tiddlers.length-config.numRssItems;
for (var t=tiddlers.length-1; t>=n; t--)
s.push(tiddlers[t].saveToRss(u));
// And footer
s.push("</channel>");
s.push("</rss>");
// Save it all
return s.join("\n");
};
//
// Initializations
//
bidix.generateRss = generateRss; // backup core version
generateRss = bidix.generateRssByTag; // install new one
config.options.txtRssTag = "toRSS"; // default RssTag. use <<option txtRssTag>> to overwritte
merge(config.optionsDesc,{txtRssTag: "Only tiddlers with this tag will be included in the RSS Feed."});
//}}}
The [[poker-network|http://pokersource.info/]] server depends on the following hardward and operating system resources:
* storage: the MySQL database
* number of users: the number of simultaneous TCP/IP connections supported by the poll(2) system call
* RAM: mostly used to represent players
* processor: mostly stressed when playing hands
* entropy: required when shuffling cards
The goal of the stress tests is to calculate the following numbers:
* storage: average number of bytes per user and per hand, average number of requests per second
* number of users: maximum number of simultaneous users
* RAM: average number of bytes per player
* process: average number of hands per second
* entropy: number of bytes available
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
Logo by [[DanielBaird|http://deuceofalltrades.com]]
*[[Introduction]]
*[[Methodology]]
*[[Analysis]]
*[[Conclusions]]
*<<publisher>>
!Hardware
# 3.2GHz Xeon dual core, 2GB RAM, Gigabyte ethernet, 160GB IDE disk
# bi-2GHz Opteron dual core, 4GB RAM, Gigabyte ethernet, 500GB IDE disk
!Software
Original poker-network software modified to mach the [[stress test specifications|http://pokersource.info/developers/specifications/stress-test.html]]. This includes simple minded bots that can be programmed to behave as normal players.
A normal player is modeled with a bot that plays a random action (check, call, raise) and require an average of two seconds to act.
The bots and the server are pre-programmed with the XML files from http://svn.gna.org/viewcvs/pokersource/trunk/poker-network/examples/stress/. They define 1,000 poker tables and chunks of 1,000 bot players ranging from 0 to 9 included.
!Installation
The packages are installed from :
* Xeon
{{{
deb http://farmpoker.pokersource.info/packaging-farm/poker-network/gnulinux/debian/etch/src ./
deb http://farmpoker.pokersource.info/packaging-farm/pokersource/gnulinux/debian/etch/src ./
}}}
* Opteron
{{{
deb http://farm64.pokersource.info/packaging-farm/poker-eval/gnulinux/debian/etch/src ./
deb http://farm64.pokersource.info/packaging-farm/pypoker-eval/gnulinux/debian/etch/src ./
deb http://farm64.pokersource.info/packaging-farm/poker-engine/gnulinux/debian/etch/src ./
deb http://farm64.pokersource.info/packaging-farm/poker-network/gnulinux/debian/etch/src ./
}}}
!Running
The [[monitoring machine|http://muninpks.pokersource.info/munin/pokersource.info/poker-network-1-2-0.pokersource.info.html]] is reset with the following commands
{{{
rm -fr /var/lib/munin/pokersource.info/
}}}
The server is run on the Xeon machine using the following command line
{{{
sh -x stress.sh
}}}
The bots are run on the Opteron machine using the following command line
{{{
bots.sh poker-network-1-2-0.pokersource.info:10380 0 1 2 3 4 ...
}}}
!Collecting
After a minimum of one hour, the server and the bots are killed.
The graphs are archived from the monitoring machine, with the rrdtool data files and the database is reset on the Xeon machine running the server.
The graph images were converted to thumbnails using {{{
version=1-2-0
for n in 3000 6000 10000 ; do for i in poker_players_localhost poker_hands_localhost poker_traffic_localhost cpu entropy mysql_queries ; do convert -scale 120 results/var/www/stats-${n}/pokersource.info/poker-network-${version}.pokersource.info-${i}-day.png results/var/www/stats-${n}/pokersource.info/poker-network-${version}.pokersource.info-${i}-day-small.png ; done ; done
}}}
<!--
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
-->
<!--{{{-->
<div id="stickybod">
<div id="headerWrap">
<div id="header">
<span id='searchbar' macro='search "Search: type, then press enter"'></span>
<div id="headerTitle" refresh='content' tiddler='SiteTitle'></div>
</div>
</div>
<div id="mainWrap">
<div id="main">
<div id='menu'>
<div id='menucontent' refresh='content' tiddler='MainMenu'></div>
</div>
<div id='mydisplayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
</div>
<br class='clear-float'/>
</div>
<div id="push"></div>
</div>
<div id="stickyfoot">
<div id="footer" refresh='content' force='true' tiddler='Footer'>
</div>
</div>
<!--}}}-->
<!--
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
-->
<!--{{{-->
<div class='title' macro='view title'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
|!Name|!ReadOnly|!Backstage|!SPM|
|Admin|false|true|false|
|Public|true|false|true|
/***
|''Name:''|PublisherPlugin|
|''Description:''||
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#PublisherPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
* PublisherPluginGuide
***/
//{{{
config.macros.publisher = {
modes:{
},
startMode : 'Public',
currentMode : '',
defaults: [
{name: "StyleSheet", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate}
],
tiddlerTemplates : merge({},config.tiddlerTemplates),
applyMode : function (newMode){
var oldMode = this.currentMode;
var oldStyleElement = document.getElementById(oldMode+"StyleSheet");
if (oldStyleElement){
oldStyleElement.parentNode.removeChild(oldStyleElement);
}
for (var i=0; i< this.defaults.length; i++){
var name = this.defaults[i]["name"];
var newElement = store.isTiddler(newMode + name) ? newMode + name : name;
store.removeNotification(oldMode + name, this.defaults[i]["notify"]);
store.addNotification(newElement,this.defaults[i]["notify"]);
store.notify(newElement);
}
this.currentMode = newMode;
this.switchTemplates();
this.toggleReadOnly();
this.toggleBackstage();
this.toggleSPM();
refreshDisplay();
story.publisherRefreshAllTiddlers();
},
switchTemplates : function(){
for (var n in this.tiddlerTemplates){
config.tiddlerTemplates[n] = store.detectTiddler(this.currentMode,this.tiddlerTemplates[n]);
}
},
toggleBackstage :function(){
if (this.modes[this.startMode]['backstage']){
if (backstage && backstage.button){
//if(readOnly)backstage.init();
backstage.button.style.display = "block";
backstage.show();
}
}
else if (backstage && backstage.button){
backstage.button.style.display = "none";
backstage.hide();
}
},
toggleReadOnly : function(){
if (this.modes[this.currentMode]['readOnly']){
config.options.chkHttpReadOnly = true;
readOnly = true;
//refreshDisplay();
}
else{
config.options.chkHttpReadOnly =false;
readOnly = false;
//refreshDisplay();
}
},
toggleSPM : function(){
config.options.chkSinglePageMode = (this.modes[this.currentMode]['SPM'])? true : false;
config.options.chkTopOfPageMode = (this.modes[this.currentMode]['SPM'])? true : false;
},
loadDb : function(){
var modelines = store.getTiddlerText("PublisherGroupsConfig").split("\n");
for (i=1; i<modelines.length; i++){
var modeparts = modelines[i].split("|");
this.modes[modeparts[1]] = {readOnly:eval(modeparts[2]),backstage:eval(modeparts[3]),SPM:eval(modeparts[4])};
}
},
init: function(){
this.loadDb();
this.applyMode(this.startMode);
},
handler: function(place,macroName,params,wikifier,paramString,tiddler){
if (!this.modes[this.startMode]['readOnly'] || params[0]=='force'){
choices = [];
if (params[1]){
var modes = params[1].readBracketedList();
for (var i=0;i<modes.length;i++){
choices.push({name:modes[i],caption:modes[i]+' mode'});
}
}
else{
for (var n in this.modes){
choices.push({name:n,caption:n+' mode'});
}
}
createTiddlyDropDown(place,this.onchangeselect,choices,this.currentMode);
}
},
onchangeselect : function(e){
config.macros.publisher.applyMode(this.value);
}
};
config.paramifiers.mode = {
onconfig: function(mode) {
config.macros.publisher.startMode = mode;
}
};
backstage.old_publisher_init = backstage.init;
backstage.init = function(){
this.old_publisher_init.apply(this,arguments);
wikify("<<publisher>>",document.getElementById("backstageToolbar"));
};
TiddlyWiki.prototype.isTiddler= function (title) {
return store.tiddlerExists(title) || store.isShadowTiddler(title);
};
TiddlyWiki.prototype.detectTiddler= function(prefix,title)
{
return (this.isTiddler(prefix+title)? prefix+title : title);
}
TiddlyWiki.prototype.removeNotification = function(title,fn) {
for (var i=0;i<this.namedNotifications.length;i++){
if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))
this.namedNotifications.splice(i,1);
}
};
TiddlyWiki.prototype.publisherGetTiddlerText = TiddlyWiki.prototype.getTiddlerText;
TiddlyWiki.prototype.getTiddlerText = function(title,defaultText){
if (title == 'DefaultTiddlers' && startingUp){
title = store.isTiddler(config.macros.publisher.startMode + title) ? config.macros.publisher.startMode + title: title;
}
return store.publisherGetTiddlerText(title,defaultText);
};
Story.prototype.publisherRefreshAllTiddlers = function() {
var place = document.getElementById(this.container);
var e = place.firstChild;
if(!e) return;
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
while((e = e.nextSibling) != null)
this.refreshTiddler(e.getAttribute("tiddler"),null,true);
};
config.shadowTiddlers.PublisherGroupsConfig = "|!Name|!ReadOnly|!Backstage|!SPM|\n|Admin|false|true|false|\n|Public|true|false|true|\n|User|false|false|true|";
config.shadowTiddlers.MainMenu += "<<publisher>>";
config.shadowTiddlers.AdminStyleSheet = "[[StyleSheet]]"; //config.shadowTiddlers.StyleSheet;
config.shadowTiddlers.AdminPageTemplate = "[[PageTemplate]]";//config.shadowTiddlers.PageTemplate;
config.shadowTiddlers.AdminViewTemplate = "[[ViewTemplate]]";//config.shadowTiddlers.ViewTemplate;
config.shadowTiddlers.AdminEditTemplate = "[[EditTemplate]]";//config.shadowTiddlers.EditTemplate;
config.shadowTiddlers.PublicViewTemplate = "<!--{{{-->\n<div class='title' macro='view title'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>\n<!--}}}-->";
config.shadowTiddlers.PublicStyleSheet = "/*{{{*/\n[[StyleSheet]]\n\n#displayArea {margin-right:1em;}\n\n.admin {display:none;}\n\n/*}}}*/";
config.shadowTiddlers.PublicPageTemplate = store.getTiddlerText("PageTemplate").replace("\n<div id='sidebar'>\n<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>","");
//}}}
//!END-PLUGIN-CODE
// %/
The Publisher plugin defines different 'modes' that can be configured to have a different look and feel and editing options. The different modes are defined in the tiddler PublisherGroupsConfig.
The current modes defined are 'Admin' and 'Public'.
To customize the Public mode edit:
*PublicStyleSheet
*PublicPageTemplate
*PublicViewTemplate
*PublicEditTemplate
*PublicDefaultTiddlers
For the Admin mode:
*AdminStyleSheet
*AdminPageTemplate
*AdminViewTemplate
*AdminEditTemplate
*AdminDefaultTiddlers
If any of the above tiddlers do not exist the plugin uses the default TiddlyWiki version instead.
/***
|''Name:''|SearchTextTweaks|
|''Description:''||
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#SearchTextTweaks|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0 beta|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
*
***/
// /%
//!BEGIN-PLUGIN-CODE
//{{{
config.macros.search.old_handler = config.macros.search.handler;
config.macros.search.handler = function(place,macroName,params)
{
this.old_handler.apply(this,arguments);
place.lastChild.onblur = function(e){this.value="Search: type, then press enter";};
};
config.macros.search.onFocus = function(e)
{
this.value = '';
this.select();
};
//}}}
//!END-PLUGIN-CODE
// %/
{{sidetabs{
*<<slider chkSliderSideBarTabs SideBarTabs "tabs »" "show tabs">>
}}}
/***
|Name|SinglePageModePlugin|
|Source|http://www.TiddlyTools.com/#SinglePageModePlugin|
|Version|2.3.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.displayTiddler(), Story.prototype.displayTiddlers()|
|Description|Display tiddlers one at a time with automatic update of URL (permalink). Also, options to always open tiddlers at top/bottom of page|
Normally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.
!!!!!Usage
<<<
SinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. When SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.
Even when SinglePageMode is disabled (i.e., displaying multiple tiddlers is permitted), you can reduce the potential for confusion by enable TopOfPageMode, which forces tiddlers to always open at the top of the page instead of being displayed following the tiddler containing the link that was clicked.
<<<
!!!!!Configuration
<<<
When installed, this plugin automatically adds checkboxes in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. For convenience, these checkboxes are also included here:
<<option chkSinglePageMode>> Display one tiddler at a time
<<option chkTopOfPageMode>> Always open tiddlers at the top of the page
<<option chkBottomOfPageMode>> Always open tiddlers at the bottom of the page
//(note: if both settings are selected, "top of page" is used)//
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)
^^documentation and javascript for SinglePageMode handling^^
When installed, this plugin automatically adds checkboxes in the ''shadow'' AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to ''manually add these checkboxes to your customized tiddler.''
<<<
!!!!!Revision History
<<<
''2007.03.03 [2.3.1]'' fix typo when adding BPM option to AdvancedOptions (prevented checkbox from appearing)
''2007.03.03 [2.3.0]'' added support for BottomOfPageMode (BPM) based on request from DaveGarbutt
''2007.02.06 [2.2.3]'' in Story.prototype.displayTiddler(), use convertUnicodeToUTF8() for correct I18N string handling when creating URL hash string from tiddler title (based on bug report from BidiX)
''2007.01.08 [2.2.2]'' use apply() to invoke hijacked core functions
''2006.07.04 [2.2.1]'' in hijack for displayTiddlers(), suspend TPM as well as SPM so that DefaultTiddlers displays in the correct order.
''2006.06.01 [2.2.0]'' added chkTopOfPageMode (TPM) handling
''2006.02.04 [2.1.1]'' moved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals
''2005.12.27 [2.1.0]'' hijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list). Also, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers
''2005.12.27 [2.0.0]'' Update for TW2.0
''2005.11.24 [1.1.2]'' When the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts
''2005.10.14 [1.1.1]'' permalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them
''2005.10.14 [1.1.0]'' added automatic setting of window title and location bar ('auto-permalink'). feature suggestion by David Dickens.
''2005.10.09 [1.0.1]'' combined documentation and code in a single tiddler
''2005.08.15 [1.0.0]'' Initial Release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].
Support for BACK/FORWARD buttons adapted from code developed by Clint Checketts
<<<
!!!!!Code
***/
//{{{
version.extensions.SinglePageMode= {major: 2, minor: 3, revision: 1, date: new Date(2007,3,3)};
if (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkSinglePageMode>> Display one tiddler at a time";
if (config.options.chkTopOfPageMode==undefined) config.options.chkTopOfPageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkTopOfPageMode>> Always open tiddlers at the top of the page";
if (config.options.chkBottomOfPageMode==undefined) config.options.chkBottomOfPageMode=false;
config.shadowTiddlers.AdvancedOptions += "\n<<option chkBottomOfPageMode>> Always open tiddlers at the bottom of the page";
config.SPMTimer = 0;
config.lastURL = window.location.hash;
function checkLastURL()
{
if (!config.options.chkSinglePageMode)
{ window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }
if (config.lastURL == window.location.hash)
return;
var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));
tiddlerName=tiddlerName.replace(/\[\[/,"").replace(/\]\]/,""); // strip any [[ ]] bracketing
if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);
}
if (Story.prototype.SPM_coreDisplayTiddler==undefined) Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)
{
if (config.options.chkSinglePageMode) {
window.location.hash = encodeURIComponent(convertUnicodeToUTF8(String.encodeTiddlyLink(title)));
config.lastURL = window.location.hash;
document.title = wikifyPlain("SiteTitle") + " - " + title;
story.closeAllTiddlers();
if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);
}
if (config.options.chkTopOfPageMode) { story.closeTiddler(title); srcElement=null; }
else if (config.options.chkBottomOfPageMode) { story.closeTiddler(title); srcElement="bottom"; }
this.SPM_coreDisplayTiddler.apply(this,arguments);
if (config.options.chkTopOfPageMode) window.scrollTo(0,0); // make sure top of page is visible
else if (config.options.chkBottomOfPageMode) {
var display=document.getElementById("tiddlerDisplay"); // for TW2.1-
if (!display) var display=document.getElementById("storyDisplay"); // for TW2.2+
window.scrollTo(0,ensureVisible(display.lastChild)); // make sure last tiddler is visible
}
}
if (Story.prototype.SPM_coreDisplayTiddlers==undefined) Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;
Story.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)
{
// suspend single-page mode (and/or top/bottom display options) when showing multiple tiddlers
var saveSPM=config.options.chkSinglePageMode; config.options.chkSinglePageMode=false;
var saveTPM=config.options.chkTopOfPageMode; config.options.chkTopOfPageMode=false;
var saveBPM=config.options.chkBottomOfPageMode; config.options.chkBottomOfPageMode=false;
this.SPM_coreDisplayTiddlers.apply(this,arguments);
config.options.chkBottomOfPageMode=saveBPM;
config.options.chkTopOfPageMode=saveTPM;
config.options.chkSinglePageMode=saveSPM;
}
//}}}
http://pokersource.info/stress-test/2007-08/
<!--{{{-->
<style type="text/css">#contentWrapper {display:none;}</style>
<div id="splashScreen" style="border:none; width:500px;margin: 200px auto; color:#333; font-size: 26px; font-family: Lucida Grande, Tahoma, Arial, Helvetica, sans-serif; text-align:center; line-height:1.5em;">
<img src='results/var/www/stats-3000/pokersource.info/poker-network-1-2-0.pokersource.info-cpu-day-small.png'><br>
<img src='loading2.gif'>
</div>
<!--}}}-->
/***
|''Name:''|SplashScreenPlugin|
|''Description:''|Provides a splash screen, while ~TiddlyWiki is loading|
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#SplashScreenPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.2|
!! Installation:
# Copy the contents of this tiddler to your TiddlyWiki file.
# Tag it as systemConfig.
# Save and reload.
# Save a second time for the SplashScreen to be initialized.
# Next time you reload, the SplashScreen will be visible.
!! Upgrade
To upgrade from a previous version, less than 2.0:
# Delete the tiddler MarkupPreHead
# Delete the SplashScreenPlugin tiddler.
# Save and reload.
# Follow the installation instructions above.
***/
// /%
//!BEGIN-PLUGIN-CODE
window.lewcidAddToMarkupBlock = function(s,blockName,newChunk)
{
var sep = s.indexOf("<!--%0-END-->".format([blockName]));
return ( s.substring(0,sep) + "\n" + newChunk + "\n" + s.substring(sep) );
};
config.shadowTiddlers["SplashScreen"] = '<!--{{{-->\n<style type="text/css">#contentWrapper {display:none;}</style><div id="splashScreen" style="border: 3px solid #ccc; text-align: center; width: 320px; margin: 100px auto; padding: 50px; color:#000; font-size: 28px; font-family:Tahoma; background-color:#eee;"><b>[[SiteTitle]]</b> is loading<blink> ...</blink><br><br><span style="font-size: 14px; color:red;">Requires Javascript.</span></div>\n<!--}}}-->';
window.splashscreenAddToMarkupBlock = function(s)
{
return lewcidAddToMarkupBlock(s,"PRE-BODY",store.getRecursiveTiddlerText("SplashScreen"));
};
updateMarkupBlock_old_splashscreen = window.updateMarkupBlock;
window.updateMarkupBlock = function (s,blockName,tiddlerName)
{
s = updateMarkupBlock_old_splashscreen.apply(this,arguments);
if (blockName == "PRE-BODY")
s = splashscreenAddToMarkupBlock(s);
return s;
};
//!END-PLUGIN-CODE
// %/
/*
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
*/
/*{{{*/
html, * {
margin:0pt;
padding:0pt;
}
body {
background:#FFFFFF;
color:#000000;
font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;
}
html, body, #contentWrapper {
height: 100%;
}
body #contentWrapper {
display:block;
}
#stickybod{
min-height: 100%;
background:#F0EFEE none repeat scroll 0%;
height: auto !important;
height: 100%;
margin: 0 auto -94px;
}
#headerWrap{
background:#FFFFFF none repeat scroll 0%;
height:94px;
width:100%;
}
#header{
background:transparent none repeat scroll 0%;
display:block;
height:94px;
margin:0pt auto;
width:950px;
}
#headerTitle {
color:#01752E;
font-family:Georgia;
font-size:4em;
font-weight:bold;
line-height:1.8em;
padding:13px 0px 0px 10px;
}
#searchbar {
float:right;
width:19em;
padding-top:50px;
margin-right:14px;
}
#searchbar .button {
display: none;
}
#searchbar input {
border:4px solid [[ColorPalette::PrimaryLight]];
padding:0.2em;
width:96%;
font-family: "Lucida Grande",Verdana,Arial,sans-serif;
color: [[ColorPalette::TertiaryDark]];
}
#searchbar input:hover{
color: [[ColorPalette::Foreground]];
}
#mainWrap{
background:#F0EFEE none repeat scroll 0%;
width:100%;
margin:0 auto;
position:relative;
}
#main{
margin:0pt auto;
width:950px;
display: block;
/* height : 300px; testing only*/
position:relative;
}
#stickyfoot{
background:#FFFFFF none repeat scroll 0%;
height:94px;
width:100%;
}
#stickyfoot, #push {
height: 94px;
}
#footer{
background:transparent none repeat scroll 0%;
display:block;
height:94px;
margin:0pt auto;
width:950px;
line-height:94px;
text-align:center;
font-weight: bold;
color: [[ColorPalette::TertiaryDark]];
}
#mydisplayArea{
float:left;
width: 699px;/*testing*/
padding-top:65px;
padding-bottom: 40px;
}
#menu{
float:left;
margin:0pt;
width:250px; /*testing*/
padding-top:65px;
padding-bottom: 40px;
}
#mysidebar {
position:relative;
margin-top:20px;
}
br.clear-float{
clear:both;
height:0px;
overflow:hidden;
}
#tiddlerDisplay{
margin-left:45px;
}
/* */
#menucontent, #mysidebar{
background:#ffffff;
padding:10px;
line-height:1.4em;
font-size:1.1em;
}
#menucontent ul, .sidetabs ul {
list-style-image:none;
list-style-position:outside;
list-style-type:none;
}
#menucontent li a, #sidebarOptions .button, .sidetabs li .button {
display:block;
padding: 5px 0px 5px 15px;
height:17px;
background:#75C20F /*#84B638*/;
border:1px solid #fff;
color:#fff;
}
#menucontent li a:hover, #menucontent a.activeLink, #sidebarOptions .button:hover, .sidetabs li .button:hover {
background:#01752E;
/*padding:5px 0px 5px 25px;*/
}
#menucontent li select{
width:99%;
padding:3px 5px;
margin: 1px 1px;
font-weight:bold;
border:1px solid #75C20F;
background:#75C20F;
color:#fff;
}
.sidetabs li a, .sidetabs .sliderPanel {
margin:0em 0.2em;
}
#sidebarTabs .sidetabs .tabContents{
width:auto;
}
#sidebarOptions .txtOptionInput{
width:93.5%;
border:1px solid #01752E;
margin:0.1em 0.3em 0.4em 0.3em;
padding:0.2em;
}
#sidebarOptions .sliderPanel {
margin:0 0.4em 0 1em;
}
.imageLink:hover, .imageLink {background:transparent;}
.tiddler{
background:#ffffff;
margin-bottom:20px;
padding:10px;
}
.title{
font-family: "Lucida Grande",Arial,sans-serif;
color:#75C20F;
border-top:8px solid #75C20F;
padding:15px 8px 8px;
font-weight: normal;
color:#70AF00;
font-size:1.8em;
font-family:Georgia,serif;
font-weight:bold;
line-height:1em;
}
.subtitle{
padding:0 8px;
}
.tagged, .tagging {
position:relative;
float:none;
margin: 0.5em 0.7em;
padding:6px 4px;
}
.tagged li, .tagging li, .tagging ul, .tagged ul{
display:inline;
}
.tagged li, .tagging li {
margin-right:0.5em;
}
.tagging .listTitle{
display:none;
}
.tagging .button:hover, .tagged .button:hover{
background: [[ColorPalette::PrimaryMid]];
color:[[ColorPalette::Background]];
}
.toolbar {
float:right;
margin-top:1.3em;
}
.viewer {
padding: 0.5em 0.75em;
line-height:1.5em;
}
.tagging, .selected .tagging, .tagged, .selected .tagged {
border:1px solid [[ColorPalette::TertiaryPale]];
background-color:[[ColorPalette::TertiaryPale]];
}
.viewer hr {
border:0;
border-top:solid 5px [[ColorPalette::SecondaryDark]];
margin:0 5px;
}
.viewer blockquote {
border-left:4px solid [[ColorPalette::SecondaryDark]];
}
h1 {
border-bottom:2px solid [[ColorPalette::SecondaryDark]];
}
h2,h3 {
border-bottom:1px solid [[ColorPalette::SecondaryDark]];
}
.viewer table, table.twtable {
border:2px solid [[ColorPalette::PrimaryMid]];
}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {
background:[[ColorPalette::PrimaryLight]];
border:1px solid [[ColorPalette::PrimaryMid]];
color:[[ColorPalette::Background]];
}
.viewer td, .viewer tr, .twtable td, .twtable tr {
border:1px solid [[ColorPalette::PrimaryMid]];
}
.viewer pre {
margin-left:0em;
}
.viewer pre {
background:#F0EFEE;
border:1px dotted [[ColorPalette::PrimaryMid]];
padding:0.5em;
}
.button {
color:[[ColorPalette::PrimaryDark]];
border:1px solid [[ColorPalette::Background]];
}
.button:hover, .button:active {
color:[[ColorPalette::PrimaryDark]];
background:transparent;
border-color:[[ColorPalette::Background]];
}
.viewer .button {
border:1px solid [[ColorPalette::PrimaryMid]];
}
.viewer .button:hover {
background: [[ColorPalette::PrimaryMid]];
color: [[ColorPalette::Background]];
}
.highlight, .marked {
background:[[ColorPalette::PrimaryMid]];
color:[[ColorPalette::Background]];
}
/*set monospaced font when editing tiddlers */
.editor textarea,.editor input
{
font-family:'Consolas' monospace;
}
#messageArea {
border:1px solid [[ColorPalette::PrimaryMid]];
background:[[ColorPalette::TertiaryPale]];
color:[[ColorPalette::Foreground]];
}
#messageArea .button {
color:[[ColorPalette::Background]];
background:[[ColorPalette::PrimaryMid]];
border:none;
padding:3px;
}
#messageArea {
top: auto;
bottom: 0;
}
/*}}}*/
/***
|''Name:''|TiddlerSubtitleTweak|
|''Description:''||
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#TiddlerSubtitleTweak|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.0 beta|
|''Date:''||
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
*
***/
// /%
//!BEGIN-PLUGIN-CODE
//{{{
window.old_website_getTiddlyLinkInfo = window.getTiddlyLinkInfo;
window.getTiddlyLinkInfo = function(title,currClasses)
{
var x = window.old_website_getTiddlyLinkInfo.apply(this,arguments);
x.subTitle = title;
return x;
}
//}}}
//!END-PLUGIN-CODE
// %/
/***
|''Name:''|TiddlyLightBox|
|''Date:''|Jan 1, 2006|
|''Version:''|1.0 beta|
|''Author:''|Saq Imtiaz|
|''Location:''|http://tw.lewcid.org/#TiddlyLightBoxPlugin|
|''Documentation:''|http://tw.lewcid.org/#TiddlyLightBoxDocs|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|''Based on:''|DC3.LightBox<br>Light Box Gone Wild <br>Ibox|
!!Code
***/
//{{{
config.macros.imagebox ={};
config.macros.imagebox.handler = function (place,macroName,params,wikifier,paramString,tiddler)
{
var e = place.lastChild;
e.onclick = function(){TiddlyLightBox.initBox('image',this,params[1],params[2],params[0]);return false;};
}
config.macros.divbox ={};
config.macros.divbox.handler = function (place,macroName,params,wikifier,paramString,tiddler)
{
if (params[0]!=".")
createTiddlyButton(place,params[0],params[0],function(){TiddlyLightBox.initBox('html',params[1],params[3],params[4],params[2]);return false;});
else
{
var e = place.lastChild;
e.onclick = function(){TiddlyLightBox.initBox('html',params[1],params[3],params[4],params[2]);return false;};
}
}
config.macros.tiddlerbox ={}
config.macros.tiddlerbox.handler = function (place,macroName,params,wikifier,paramString,tiddler)
{
config.macros.divbox.handler(place,macroName,[params[0],"tiddler:"+params[1],params[2],params[3],params[4]]);
return false;
}
store.addNotification("TiddlyLightBoxStyles",refreshStyles);
if (!window.TiddlyLightBox)
window.TiddlyLightBox = {};
var loadingImage = "indicator.gif";
window.TiddlyLightBox =
{
_curBox: null, // [sentinel]
lightBoxHtml : '<div id="lightBoxOverlay" onclick="TiddlyLightBox.hideBox()" style="display:none"></div><div id="lightboxprogress" style="display:none;"><img src=\''+loadingImage+'\' alt=\'loading\' style="width:128px;height:128px;"></div><div class="lightBox" id="lightBox" style="display:none"><div id="lightBoxContent"></div><div id="lightBoxTitle">This is a title</div><div id="lightBoxClose"><a href:"#" onclick="TiddlyLightBox.hideBox();return false;">Click to close</a></div></div>',
createBoxWrapper : function()
{
var wrapper = createTiddlyElement(document.getElementsByTagName("body")[0],"div","tiddlyLightBoxWrapper");
wrapper.innerHTML = this.lightBoxHtml;
},
initBox : function(contentType,url,w,h,text)
{
if (this._curBox)
return;
this.showProgress();
this.hideSelects("hidden");
this.showBg();
this._curBox = true;
this.sizeTheBox(contentType,w,h);
if (contentType == 'image')
this.showImage(url,text);
else if (contentType == 'html')
this.showHtml(url,text);
return false;
},
sizeTheBox : function(contentType,w,h)
{
var box = document.getElementById("lightBoxContent");
if (w && isNaN(parseInt(w)))
{
addClass(box,w);
}
else if (w ||h || contentType == 'html')
{
box.style.width = w? w+ "px" : "450px";
box.style.height = h? h+ "px" : "280px";
if (contentType=='image')
setStylesheet("#lightBoxContent img{height:100%;width:100%;}","lightBoxImageSizeHack");
}
},
showProgress : function()
{
var progress = document.getElementById("lightboxprogress");
progress.style.display='';
this._center(progress);
},
hideProgress: function()
{
var progress = document.getElementById("lightboxprogress");
progress.style.display='none';
},
//this function lifted from Lightbox Gone Wild
hideSelects: function(visibility)
{
var selects = document.getElementsByTagName('select');
for(i = 0; i < selects.length; i++)
{
selects[i].style.visibility = visibility;
}
},
showBg: function()
{
var overlay = document.getElementById('lightBoxOverlay');
if (config.browser.isIE)
{
overlay.style.height = Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight);
overlay.style.width = document.documentElement.scrollWidth;
}
overlay.style.display = 'block';
},
showImage: function (url,text)
{
imgPreloader = new Image();
imgPreloader.onload = function ()
{
var lb = document.getElementById("lightBoxContent");
lb.innerHTML = "<img src="+url+">";
lb.onclick = function(){TiddlyLightBox.hideBox();return false;};
TiddlyLightBox.posBox(text);
};
imgPreloader.src = url;
},
showHtml : function(theID,text)
{
var lb = document.getElementById("lightBoxContent");
if (theID.indexOf("tiddler:")==-1)
lb.innerHTML = document.getElementById(theID).innerHTML;
else
{
wikify(store.getTiddlerText(theID.replace("tiddler:","")),lb);
lb.className='tiddler';
}
lb.style.overflow = "auto";
this.posBox(text);
},
posBox: function(text)
{
this.setTitle(text);
this.hideProgress();
var lb = document.getElementById("lightBox");
lb.style.display = "";
lb.style.visibilty = "hidden";
lb.style.position = "absolute";
this._center(lb);
if(!TiddlyLightBox._curBox) return;
lb.style.visibility = "visible";
lb.style.display = "block";
},
setTitle: function(text)
{
document.getElementById("lightBoxTitle").innerHTML= (text==undefined)? '': text;
},
_center: function(lb)
{
var lbSize = new TiddlyLightBox.getElementSize(lb);
lb.style.left = (Math.round(findWindowWidth()/2) - (lbSize.width /2) + findScrollX())+'px';
lb.style.top = (Math.round(findWindowHeight()/2) - (lbSize.height /2) + findScrollY())+'px';
},
//this function lifted from Ibox
getElementSize : function(elem)
{
this.width = elem.offsetWidth || elem.style.pixelWidth;
this.height = elem.offsetHeight || elem.style.pixelHeight;
},
hideBox: function()
{
if(!this._curBox)
return;
document.getElementById("tiddlyLightBoxWrapper").innerHTML= this.lightBoxHtml;
setStylesheet("","lightBoxImageSizeHack");
this._curBox = null;
return false;
}
}
TiddlyLightBox.createBoxWrapper();
Story.prototype.findContainingTiddler = function(e)
{
while(e && (!hasClass(e,"tiddler") || !e.getAttribute("tiddler")))
e = e.parentNode;
return(e);
}
config.shadowTiddlers.TiddlyLightBoxStyles="/*{{{*/\n#lightBoxOverlay {\n position:absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 90; \n background-color: #000;\n -moz-opacity: 0.75;\n opacity: .75;\n filter: alpha(opacity=75);\n}\n#lightBoxOverlay[id]{ \n position: fixed;\n}\n\n#lightboxprogress { \n margin:0;padding:0;\n position: absolute;\n z-index:95;\n}\n\ndiv.lightBox {\n background: #fff;\n color: #fff;\n border: 4px solid #525252;\npadding:20px 20px 25px 20px; position:absolute; z-index:99;\n}\n\n#lightBoxClose {text-align:right; color:#000; font-size:1.0em; position:absolute; bottom:6px; right:20px;}\n#lightBoxClose a{color:#666; border-bottom:1px solid #666;cursor:pointer;}\n#lightBoxClose a:hover {color:#111; border-bottom:1px solid #666; cursor:pointer; background:transparent;}\n\n#lightBoxContent {border:1px solid #525252;color:#000; background:#fff;}\n#lightBox .tiddler {background:#fff;}\n\n#lightBoxContent img {border:0;margin:0;padding:0;display:block;cursor:pointer;}\n\n#lightBoxTitle {padding:0px; font-weight:bold; position:absolute; left:20px;bottom:6px; font-size:1.1em; color:#000;}\n\n/*}}}*/";
//}}}
<!--
Theme by [[Saq 'Lewcid' Imtiaz|http://tw.lewcid.org]]
<html><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
<img alt="Creative Commons License" style="border-width:0;background:transparent;" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" />
</a>
<br />This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.</html>
-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'>by <span macro='view modifier link'></span>, <span macro='view modified date'></span></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagging' macro='tagging'>Related: </div>
<div class='tagClear'></div>
<!--}}}-->
/***
|''Name:''|WebDAVSavingPlugin|
|''Description:''|Saves on a WebDAV server without the need of any ServerSide script.<br>When TiddlyWiki is accessed over http, this plugin permits to save back to the server, using http PUT.|
|''Version:''|0.2.1|
|''Date:''|Apr 21, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#WebDAVSavingPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.WebDAVSavingPlugin = {
major: 0, minor: 2, revision: 1,
date: new Date("Apr 21, 2007"),
source: 'http://tiddlywiki.bidix.info/#WebDAVSavingPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
coreVersion: '2.2.0 (Beta 5)'
};
if (!window.bidix) window.bidix = {};
bidix.WebDAVSaving = {
orig_saveChanges: saveChanges,
defaultFilename: 'index.html',
messages: {
loadOriginalHttpDavError: "Original file can't be loaded",
optionsMethodError: "The OPTIONS method can't be used on this ressource : %0",
webDavNotEnabled: "WebDAV is not enabled on this ressource : %0",
notHTTPUrlError: "WebDAV saving can be used for http viewed TiddlyWiki only",
aboutToSaveOnHttpDav: 'About to save on %0 ...' ,
folderCreated: "Remote folder '%0' created"
}
};
// Save this tiddlywiki with the pending changes
saveChanges = function(onlyIfDirty,tiddlers)
{
var originalPath = document.location.toString();
if (originalPath.substr(0,5) == "file:")
return bidix.WebDAVSaving.orig_saveChanges(onlyIfDirty,tiddlers);
else
return bidix.WebDAVSaving.saveChanges(onlyIfDirty,tiddlers);
}
bidix.WebDAVSaving.saveChanges = function(onlyIfDirty,tiddlers)
{
var callback = function(status,params,original,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (!status)
displayMessage(bidix.WebDAVSaving.messages.optionsMethodError.format([url]));
else {
if (!xhr.getResponseHeader("DAV"))
alert(bidix.WebDAVSaving.messages.webDavNotEnabled.format([url]));
else
bidix.WebDAVSaving.doSaveChanges();
}
}
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
var originalPath = document.location.toString();
// Check we were loaded from a HTTP or HTTPS URL
if(originalPath.substr(0,4) != "http") {
alert(bidix.WebDAVSaving.messages.notHTTPUrlError);
return;
}
// is the server WebDAV enabled ?
var r = doHttp("OPTIONS",originalPath,null,null,null,null,callback,null,null);
if (typeof r == "string")
alert(r);
}
bidix.WebDAVSaving.doSaveChanges = function()
{
var callback = function(status,params,original,url,xhr) {
if (!status) {
alert(config.messages.loadOriginalHttpDavError);
return;
}
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.WebDAVSaving.mkbackupfolder(null,null,params,original,posDiv);
};
// get original
var originalPath = document.location.toString();
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + bidix.WebDAVSaving.defaultFilename;
displayMessage(bidix.WebDAVSaving.messages.aboutToSaveOnHttpDav.format([originalPath]));
doHttp("GET",originalPath,null,null,null,null,callback,originalPath,null);
};
bidix.WebDAVSaving.mkbackupfolder = function(root,dirs,url,original,posDiv) {
if (!root || !dirs) {
root = bidix.dirname(url);
if (config.options.txtBackupFolder == "")
dirs = null;
else
dirs = config.options.txtBackupFolder.split('/');
}
if (config.options.chkSaveBackups && dirs && (dirs.length > 0))
bidix.WebDAVSaving.mkdir(root,dirs.shift(),dirs,url,original,posDiv);
else
bidix.WebDAVSaving.saveBackup(url,original,posDiv);
};
bidix.WebDAVSaving.saveBackup = function(url,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if (!status) {
alert(config.messages.backupFailed);
return;
}
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
displayMessage(config.messages.backupSaved,url);
bidix.WebDAVSaving.saveRss(params[0],params[1],params[2]);
};
if(config.options.chkSaveBackups) {
var backupPath = getBackupPath(url);
bidix.httpPut(backupPath,original,callback,Array(url,original,posDiv));
} else {
bidix.WebDAVSaving.saveRss(url,original,posDiv);
}
}
bidix.WebDAVSaving.saveRss = function(url,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if (!status) {
alert(config.messages.rssFailed);
return;
}
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
displayMessage(config.messages.rssSaved,url);
bidix.WebDAVSaving.saveEmpty(params[0],params[1],params[2]);
};
if(config.options.chkGenerateAnRssFeed) {
var rssPath = url.substr(0,url.lastIndexOf(".")) + ".xml";
bidix.httpPut(rssPath,convertUnicodeToUTF8(generateRss()),callback,Array(url,original,posDiv));
} else {
bidix.WebDAVSaving.saveEmpty(url,original,posDiv);
}
}
bidix.WebDAVSaving.saveEmpty = function(url,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if (!status) {
alert(config.messages.emptyFailed);
return;
}
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
displayMessage(config.messages.emptySaved,url);
bidix.WebDAVSaving.saveMain(params[0],params[1],params[2]);
};
if(config.options.chkSaveEmptyTemplate) {
var emptyPath,p;
if((p = url.lastIndexOf("/")) != -1)
emptyPath = url.substr(0,p) + "/empty.html";
else
emptyPath = url + ".empty.html";
var empty = original.substr(0,posDiv[0] + startSaveArea.length) + original.substr(posDiv[1]);
bidix.httpPut(emptyPath,empty,callback,Array(url,original,posDiv));
} else {
bidix.WebDAVSaving.saveMain(url,original,posDiv);
}
}
bidix.WebDAVSaving.saveMain = function(url,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
displayMessage(config.messages.mainSaved,url);
store.setDirty(false);
} else
alert(config.messages.mainFailed);
};
// Save new file
var revised = updateOriginal(original,posDiv);
bidix.httpPut(url,revised,callback,null);
}
// asynchronous mkdir
bidix.WebDAVSaving.mkdir = function(root,dir,dirs,url,original,posDiv) {
var callback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (status == null) {
alert("Error in mkdir");
return;
}
if (xhr.status == httpStatus.ContentCreated) {
displayMessage(bidix.WebDAVSaving.messages.folderCreated.format([url]),url);
bidix.WebDAVSaving.mkbackupfolder(url,params[1],params[2],params[3],params[4]);
} else {
if (xhr.status == httpStatus.NotFound)
bidix.http('MKCOL',url,null,callback,params);
else
bidix.WebDAVSaving.mkbackupfolder(url,params[1],params[2],params[3],params[4]);
}
};
if (root.charAt(root.length) != '/')
root = root +'/';
bidix.http('HEAD',root+dir,null,callback,Array(root,dirs,url,original,posDiv));
}
bidix.httpPut = function(url,data,callback,params)
{
return bidix.http("PUT",url,data,callback,params);
}
bidix.http = function(type,url,data,callback,params)
{
var r = doHttp(type,url,data,null,null,null,callback,params,null);
if (typeof r == "string")
alert(r);
return r;
}
bidix.dirname = function (filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
//}}}