Noob at play warning. 
I really liked this though I've taken a little bit of a different route and 
have come upon a rather odd issue. 

I would like to avoid having to have two buttons all together and use CSS 
to change the unpin/pin button which I do by loading this inline script 
right after the pinTiddler command:
<script>
jQuery(".command_pinTiddler").click(function () {
jQuery(this).toggleClass("isPinned");} );
</script>

Digressing the issue I am having is when I try to change the pinTiddler 
command to cycle though:


config.commands.pinTiddler = { 
text: "pin", 
tooltip: "Pin this tiddler from getting closed by Close All Others", 
isEnabled: function(tiddler) { 
return !tiddler.pinned; 
}, 
handler: function(event,src,title) { 
var e = story.findContainingTiddler(src); if (!e) return false; 
if (e.getAttribute("pinned","true")) { 
e.setAttribute("pinned","false");} 
else { 
e.setAttribute("pinned","true");} 
}, 
} 

On the first click it adds true, on the second click it changes it to 
false, on the third and all following clicks it stays on false?
I don't understand why it's getting stuck on false. I've tried using an if 
else statements as well if true than false, if else false than true, else 
true, but it has the exact same effect.  




On Saturday, June 1, 2013 7:58:54 AM UTC-7, G.J.Robert wrote:
>
> It occurred to me that CSS selectors may help in giving recognizable 
> changes in style for pinned/unpinned tiddlers, and also the display of the 
> toolbar buttons. Since this plugin suits my needs to a certain extent I 
> have updated my alpha version of PinTiddlerPlugin and republished it on my 
> main space: http://gjrobert.tiddlyspace.com/#PinTiddlersPlugin . As 
> mentioned, this plugin derives mostly from pieces of work by Eric, so the 
> gratitude goes to him. Any other suggestion and advice are welcome.
>
> G.J.Robert於 2013年5月31日星期五UTC+8上午11時51分54秒寫道:
>>
>> Based on Eric's kind snippet, I have organized my experimental thoughts 
>> and proposed a draft/early alpha of "PinTiddlersPlugin" ( 
>> http://gjobert.tiddlyspace.com/#PinTiddlersPlugin(alpha)%20PinTiddlersFunction)
>>  to use tiddler attribute other than tag to store the pinned status. (just 
>> like CollapsedTiddlersPlugin, which I just got to use on my spaces 
>> recently). I'm thinking of switching "pin/unpin" buttons based on the 
>> status of a tiddler and refresh the button when the status is changed, but 
>> I'm not sure how to do it, so I'm calling for help/advice here. I also need 
>> help on how we may write titles of tiddlers into a saved list... Any 
>> tips/suggestions appreciated ^^ Pardon for a novice plugin learner s'il 
>> vout plait :-)
>>
>> G.J.Robert於 2013年5月31日星期五UTC+8上午7時51分16秒寫道:
>>>
>>> Ha! It works! And of course it goes well with CollpaseTiddlersPlugin. 
>>> Thanks a lot! This way I can use ToggleTagPlugin to have a check box for 
>>> each tiddler to toggle "pinned" status on the run, and also save them 
>>> across sessions. Great!
>>>
>>> From your code, I just came up with another idea using storage other 
>>> than the tag field: using a "PinnedTiddlers" tiddler to list and store all 
>>> tiddlers toggled as true on the checkbox, and thus can be read by the 
>>> modified closeAllTiddlers function. I think this can reduce the transfers 
>>> needed with remote servers, especially for enviroments like TSpace. :-)
>>>
>>> Eric Shulman於 2013年5月31日星期五UTC+8上午12時16分22秒寫道:
>>>>
>>>>
>>>>
>>>> On May 30, 5:45 am, "G.J.Robert" <robertus0...@gmail.com> wrote: 
>>>> > I frequently open quite a few tiddlers during my note taking and 
>>>> editing, 
>>>> > and I use "close all" a lot. What if I want to pin certain tiddlers 
>>>> from 
>>>> > getting closed by "close all" command/macro? Is there any plugin out 
>>>> there 
>>>> > able to do this? Thanks in advance :) 
>>>>
>>>> Here you go: 
>>>> ----------------------------- 
>>>> Story.prototype.closeAllTiddlers = function(exclude) { 
>>>>         clearMessage(); 
>>>>         this.forEachTiddler(function(title,element) { 
>>>>                 var t=store.getTiddler(title); 
>>>>                 var excluded = title == exclude; 
>>>>                 var dirty    = element.getAttribute("dirty") == "true" 
>>>>                 var pinned   = t && t.isTagged("pinned"); 
>>>>                 if(!excluded && !dirty && !pinned) 
>>>>                         this.closeTiddler(title); 
>>>>         }); 
>>>>         window.scrollTo(0,ensureVisible(this.container)); 
>>>> }; 
>>>> ------------------------------ 
>>>> To use, simply tag a tiddler with "pinned".  You can still close it 
>>>> individually with the "close" toolbar command, but it will be skipped 
>>>> over when either the "close all" sidebar command or "close others" 
>>>> toolbar command is invoked. 
>>>>
>>>> Note: when triggered by "close others", the "exclude" value passed 
>>>> into the function is the title of the tiddler from which the command 
>>>> was triggered, so that tiddler will not be closed along with the 
>>>> others.  However, when triggered by "close all", the "exclude" value 
>>>> is null, so that all tiddlers are closed, except for "dirty" tiddlers 
>>>> (i.e., tiddlers currently being edited) and tiddlers that are tagged 
>>>> with "pinned" (the new feature you requested). 
>>>>
>>>> enjoy, 
>>>> -e 
>>>> Eric Shulman 
>>>> TiddlyTools / ELS Design Studios 
>>>>
>>>> HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"... 
>>>>    http://www.TiddlyTools.com/#Donations 
>>>>
>>>> Professional TiddlyWiki Consulting Services... 
>>>> Analysis, Design, and Custom Solutions: 
>>>>    http://www.TiddlyTools.com/#Contact 
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to