Hi Alex,
Congratulation for your first macro.

Here is some FireFox food for your additional features:
IE doesn't digest it :(

config.macros.resizeWindow = {};
config.macros.resizeWindow.handler = function
(place,macroName,params,wikifier,paramString,tiddler) {

var w = params[0];
var h = params[1];

window.resizeTo(w,h);

window.onresize= config.macros.resizeWindow.onResize;

};
config.macros.resizeWindow.onResize = function () {
        var sb = document.getElementById( 'sidebar');
        var mm = document.getElementById( 'mainMenu');
        var da = document.getElementById( 'displayArea');

        if (window.innerWidth < 600) {
                sb.style.display ='none';
                mm.style.display ='none';
                da.style.margin = '1em 1em 0em 1em';
        }
        else {
                sb.style.display= 'block';
                mm.style.display= 'block';
                da.style.margin = '1em 15.7em 0em 14em';
        }
};

I use w3schools.com a lot and found the description of the DOM
functions here:

http://www.w3schools.com/jsref/default.asp
http://www.w3schools.com/jsref/dom_obj_style.asp

=====
As I found out, using:
http://tiddlywiki.org/wiki/Dev:Best_Practices
http://tiddlywiki.org/wiki/Dev:Plugin_Specifications

makes live easier :)

   //# ensure that the plugin is only installed once
if(!version.extensions.SamplePlugin) {
version.extensions.SamplePlugin = { installed: true };

if(!config.extensions) { config.extensions = {}; } //# obsolete from
v2.4.2

//!!!!!!!!!!!!!!!!!!!!!!!!
//!!!! your code here !!!!
//!!!!!!!!!!!!!!!!!!!!!!!!

} //# end of "install only once"

where SamplePlugin should be replaced!

AND
http://www.tiddlytools.com/insideTW/ is a ___great___ source if you
want to see, how the core does handle things.

regards Mario

On Jan 13, 10:56 am, Alex Hough <[email protected]> wrote:
> I liked Moris Grey's sidebar TW a lot. You can drag bits of text to
> you tw rather than cutting and pasting. But I use firefox's delicious
> plugin in the sidebar, and a tw in the sidebar never quite worked for
> me. With the recent arrival of t960 and t960black [1] and the
> conversation about golden section grids I thought that I would
> experiment with browser windows of more than one size. I have a also
> been inspired by Eastgate Systems Hypertext Garden [2]
>
> To this end, I just wrote my first plugin(!!!) which can be added to
> tiddlers to resize the window.
>
> Usage
> <<resizeWindow w h>>
> where w= width and h=height
>
> <<resizeWindow 600 400>>
>
> config.macros.resizeWindow = {};
> config.macros.resizeWindow.handler = function
> (place,macroName,params,wikifier,paramString,tiddler) {
>
> var w = params[0];
> var h = params[1];
>
> window.resizeTo(w,h);
>
> }
>
> Potential additional features
> =====================
>
> It would be nice to
> *open other TWs from a 600x400 in the top right hand corner and for
> them to position themselves on the screen in cool golden sectionish
> positions.
> *position the window on the screen
> *use in conjunction with themes. for example, if window width is less
> than 600, hide Mainmenu
>
> [1]http://t960black.tiddlyspot.com/
> [2]http://www.eastgate.com/garden/Unexpected_Delight.html
-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.


Reply via email to