🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #654

Re: [CS3 JS] Question about collecting overridden style settings

#654
From: Dirk_Becker
Date: Thu, 05 Mar 2009 21:10
24 lines
1278 bytes
Some building blocks:

To iterate the members of an object
for( n in props ) { alert(props[n]); }

To check whether another object has such a member:
if( other[n]!=undefined ) ...

To remove a named member:
delete other[n];

I wonder though how you would detect differences caused by nested styles.

Regarding toSource(), you could use that as a key in an associative array.
var styleMap = [];
var props = myStyle.properties;
delete props.name;
delete props.otherIgnoredAttribute;
var key = props.toSource();
var found = styleMap[key];
if( found!=undefined ) alert("Hey, we have a similar style"+ found.name);
else styleMap[key] = myStyle;

Dirk
Technical Details
Message-ID: <59b81cad.8@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b81cad.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,ae48fa806cc37e1a
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Dirk_Becker@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: [CS3 JS] Question about collecting overridden style settings
Message-ID: <59b81cad.8@webcrossing.la2eafNXanI>
Date: Thu, 5 Mar 2009 13:10:48 -0800
References: <59b81cad.-1@webcrossing.la2eafNXanI>
Lines: 27
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit