[tw] Re: Hijacking saveTiddler
I should also say take care when hijacking where you don't completely know what you are doing. If you do it wrong you could break the function. In this situation that means it would be impossible to save any tiddlers... so take backups :) On Dec 15, 1:47 am, skye riquelme riquelme.s...@gmail.com wrote: Ooopa..now thats exactly what I wanted to know. now to work to see if I can get it woring as I want. Thanks Skye On 14 dez, 08:18, rakugo jdlrob...@gmail.com wrote: Hijack does seem to be the right word. The idea with hijacking is // cache the old value of the function var _cache = TiddlyWiki.prototype.saveTiddler; // override the existing value TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCo unt,created,creator) { // do something new alert(!); // apply the old value return _cache.apply(this, arguments); }; Hope this helps... Jon On Dec 14, 4:00 am, skye riquelme riquelme.s...@gmail.com wrote: Hi All Not sure if Hijacking ids the right term in this case. Basically I want to modify the saveTiddler macro so that when a student saves a tiddler. the saveTiddler also does something else...in this case executes another macro that sends a message to my server..and maybe emails me a message. ths would be for specific tiddlers...not ALL! So how to hijack the saveTiddler macro to my ends...where is it in the core? Thanks Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: Hijacking saveTiddler
...thanks even more so for the advice...obviously Ill play around with a simple non-importante test TW first!!! and thanks for the warning/advice Skye On 15 dez, 12:36, rakugo jdlrob...@gmail.com wrote: I should also say take care when hijacking where you don't completely know what you are doing. If you do it wrong you could break the function. In this situation that means it would be impossible to save any tiddlers... so take backups :) On Dec 15, 1:47 am, skye riquelme riquelme.s...@gmail.com wrote: Ooopa..now thats exactly what I wanted to know. now to work to see if I can get it woring as I want. Thanks Skye On 14 dez, 08:18, rakugo jdlrob...@gmail.com wrote: Hijack does seem to be the right word. The idea with hijacking is // cache the old value of the function var _cache = TiddlyWiki.prototype.saveTiddler; // override the existing value TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCo unt,created,creator) { // do something new alert(!); // apply the old value return _cache.apply(this, arguments); }; Hope this helps... Jon On Dec 14, 4:00 am, skye riquelme riquelme.s...@gmail.com wrote: Hi All Not sure if Hijacking ids the right term in this case. Basically I want to modify the saveTiddler macro so that when a student saves a tiddler. the saveTiddler also does something else...in this case executes another macro that sends a message to my server..and maybe emails me a message. ths would be for specific tiddlers...not ALL! So how to hijack the saveTiddler macro to my ends...where is it in the core? Thanks Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: Hijacking saveTiddler
Hijack does seem to be the right word. The idea with hijacking is // cache the old value of the function var _cache = TiddlyWiki.prototype.saveTiddler; // override the existing value TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator) { // do something new alert(!); // apply the old value return _cache.apply(this, arguments); }; Hope this helps... Jon On Dec 14, 4:00 am, skye riquelme riquelme.s...@gmail.com wrote: Hi All Not sure if Hijacking ids the right term in this case. Basically I want to modify the saveTiddler macro so that when a student saves a tiddler. the saveTiddler also does something else...in this case executes another macro that sends a message to my server..and maybe emails me a message. ths would be for specific tiddlers...not ALL! So how to hijack the saveTiddler macro to my ends...where is it in the core? Thanks Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: Hijacking saveTiddler
Ooopa..now thats exactly what I wanted to know. now to work to see if I can get it woring as I want. Thanks Skye On 14 dez, 08:18, rakugo jdlrob...@gmail.com wrote: Hijack does seem to be the right word. The idea with hijacking is // cache the old value of the function var _cache = TiddlyWiki.prototype.saveTiddler; // override the existing value TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator) { // do something new alert(!); // apply the old value return _cache.apply(this, arguments); }; Hope this helps... Jon On Dec 14, 4:00 am, skye riquelme riquelme.s...@gmail.com wrote: Hi All Not sure if Hijacking ids the right term in this case. Basically I want to modify the saveTiddler macro so that when a student saves a tiddler. the saveTiddler also does something else...in this case executes another macro that sends a message to my server..and maybe emails me a message. ths would be for specific tiddlers...not ALL! So how to hijack the saveTiddler macro to my ends...where is it in the core? Thanks Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.