there is the store.filterTiddlers(fieldName) function, with allready
gives the filtered list back.
https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Filters.js

the array starts with 0.
for (var i=0...
-m

On 8 Jul., 22:42, okido <[email protected]> wrote:
> Thanks PMario,
>
> The conditional testing indeed speeds things up.
> I tried to remove about 20 fields that come from everywhere mainly
> tsnip related.
>
> Code ====
>
> <script>
> var field_name = 'tatata';
> var tids =store.getTiddlers('title')
>  for ( i=1 ; i < tids.length ; i++ ) {
>   if ( tids[i].fields[field_name]) {
>    delete tids[i].fields[field_name];
>    store.saveTiddler(tids[i].title ........ tids[i].fields );
>   }
>  }
> </script>
>
> Okido
>
> On Jul 8, 9:39 pm, PMario <[email protected]> wrote:
>
>
>
>
>
>
>
> > On 8 Jul., 19:51, okido <[email protected]> wrote:
>
> > > I use following script with inlinejavascript plugin, it removes a
> > > field from a tiddler.
> > > The problem is that it takes ages to run and most times it freezes FF
> > > 4.0.
>
> > > <script>
> > > var tids =store.getTiddlers('title')
> > >  for ( i=1 ; i < tids.length ; i++ ) {
> > >   delete tids[i].fields['fieldname'];
> > >  stor.saveTiddler(tids[i].title ........ tids[i].fields );}
>
> > > </script>
>
> > If you use FireBug, open the console. and paste the following into the
> > command editor.
>
> > var tids = store.getTiddlers('title')
> > console.log({'t':tids})
>
> > It will give you the number of tiddlers you are handling. I did a
> > short check with one of my TWs ~400
> > Since you do the save in a loop it takes a looong time.
> > =====
>
> > If you check the console you'll see that arrays start with index 0
> > for (var i=0; ... ) {}
> > =====
>
> > If the field, that you need to delete is not part of every tiddler,
> > you should check it and just save tiddlers, that are really affected.
> > =====
>
> > Which function produces the field, that you want to delete. I think
> > the best way would be to avoid the creation of the field, which would
> > solve the problem.
>
> > -m

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev?hl=en.

Reply via email to