Hi Stephan

Please do mail it, or maybe put it on GitHub? https://gist.github.com is
useful for quickly sharing code.

Best wishes

Jeremy.



On Wed, Apr 9, 2014 at 6:22 PM, Stephan Hradek <[email protected]>wrote:

> Hi Jeremy!
>
> Am Mittwoch, 9. April 2014 18:12:11 UTC+2 schrieb Jeremy Ruston:
>
>>
>> It might be helpful if you could share more of your code?
>>
>
> Except for
>
>
> var EditTextWidget =
> require("$:/core/modules/widgets/edit-text.js")["edit-text"];
>
> That was pretty much everything I coded. The rest is almost just jscolor
> code, which I just slightly changed but nothing in regards to any DOM.
>
>
>
>> I don't know enough about how jscolor works. I'd expect it to be invoked
>> on an input element, and to augment that element with additional DOM nodes
>> for the colour picker. Does it hide the original input element, or try to
>> delete it?
>>
>
> Neither. It simply puts, as far as I can see, an "onFocus" handler on it
> which then generates additional DOM stuff for the colour picker. So the
> original element is used. I can submit the "changehandler" (which I fail to
> find).
>
> So the full code I have, minus the jscolorcode itself, is:
>
> /**
>  * jscolor, JavaScript Color Picker
>  *
>  * @version 1.4.2
>  * @license GNU Lesser General Public License,
> http://www.gnu.org/copyleft/lesser.html
>  * @author  Jan Odvarko, http://odvarko.cz
>  * @created 2008-06-15
>  * @updated 2013-11-25
>  * @link    http://jscolor.com
>  */
>
>
>
> /*\
> title: $:/plugins/skeeve/jscolor.js
> type: application/javascript
> module-type: widget
> \*/
> (function(){
>
> /*jslint node: true, browser: true */
> /*global $tw: true */
> "use strict";
>
> var jscolor = {   // here the almost unmodified jscolor code follows
>
> };
>
> function twLoadImage(filename) {
>     var imageTiddler = $tw.wiki.getTiddler("$:/plugins/skeeve/jscolor/" +
> filename);
>     var src = "data:" + imageTiddler.getFieldString("type") + ";base64," +
> imageTiddler.getFieldString("text");
>     jscolor.loadImage(filename,src);
> };
>
> twLoadImage('hs.png');
> twLoadImage('hv.png');
> twLoadImage('cross.gif');
> twLoadImage('arrow.gif');
>
>
> var EditTextWidget =
> require("$:/core/modules/widgets/edit-text.js")["edit-text"];
>
> EditTextWidget.prototype.postRender = function() {
>     var domNode = this.domNodes[0];
>     if($tw.browser && this.document !== $tw.fakeDocument &&
> domNode.getAttribute("type") === "color") {
>         jscolor.color( domNode, { hash : true, onImmediateChange :
> domNode.handleInputEvent } );
>     }
> };
>
> })();
>
>
> Shall I mail the full code?
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to