Skip to content

Instantly share code, notes, and snippets.

View hilukasz's full-sized avatar

Łukasz Wieczorek hilukasz

View GitHub Profile
function MySymbol(input){
this.doc = app.activeDocument;
this.mySymbolIndex = input || 0;
this.mySymbolItem = doc.symbolItems[this.mySymbolIndex];
}
MySymbol.prototype.hasSymbolIndex = function() {
return this.mySymbolIndex <= this.doc.symbolItems.length - 1;
};
$.fn.preloader = function(options){
var defaults = {
delay:200,
preload_parent:"a",
check_timer:300,
ondone:function(){ },
oneachload:function(image){ },
fadein:500
};
function MySymbol(input){
this.doc = app.activeDocument;
this.mySymbolIndex = input || 0;
this.mySymbolItem = this.hasSymbolIndex() ? this.doc.symbolItems[this.mySymbolIndex] : false;
}
MySymbol.prototype.hasSymbolIndex = function() {
return this.mySymbolIndex <= this.doc.symbolItems.length - 1;
};
function MySymbol(input){
this.doc = app.activeDocument;
this.mySymbolIndex = input || 0;
this.mySymbolItem = this.hasSymbolIndex() ? this.doc.symbolItems[this.mySymbolIndex] : false;
}
MySymbol.prototype.hasSymbolIndex = function() {
return this.mySymbolIndex <= this.doc.symbolItems.length - 1;
};
function CSV(how, exportObjectSize, docName){
this.how = how; // append is default
this.exportSize = exportObjectSize; // yes/no
this.docName = docName; // file name to export to
}
CSV.prototype.export = function(input) {
var inputFolder = Folder.selectDialog();
var csv = new File(inputFolder+"/"+this.docName+".csv");
// open text again
MySymbol.prototype.isIn = function(parentItem, runThis) {
//var parent = doc.pathItems[0];
var isTrue;
var parentVB = parentItem.visibleBounds;
var parentLeft = parentVB[0];
var parentTop = -parentVB[1]; //make negative number a positive illustrator measures everything down as negative
var parentRight = parentVB[2];
var parentBottom = -parentVB[3]; //make negative number a positive illustrator measures everything down as negative
print("parent is : " + parent.name);
////////////////////////////////
//
// mySymbol class
//
////////////////////////////////
function rotate90(input){ input.unshift(input.pop()); } //shift array one to right so it follows CSS style borders
//accepts layer name or index
#target illustrator
//start library
// function MyLayer() { } and function SubLayer() are constructor functions
function MyLayer(input) {
this.doc = app.activeDocument;
this.myLayerIndex = input || 0;
this.myLayerItem = this.hasLayerIndex() ? this.doc.layers[this.myLayerIndex] : false;
this.subLayers = this.myLayerItem.pageItems;
#target illustrator
//start library
// function MyLayer() { } and function SubLayer() are constructor functions
function MyLayer(input) {
this.doc = app.activeDocument;
this.myLayerIndex = input || 0;
this.myLayerItem = this.hasLayerIndex() ? this.doc.layers[this.myLayerIndex] : false;
this.subLayers = [];
//start library
function MyLayer(input) {
this.doc = app.activeDocument;
this.myLayerIndex = input || 0;
this.myLayerItem = this.hasLayerIndex() ? this.doc.layers[this.myLayerIndex] : false;
this.subLayers = [];
//this.visibleBounds = this.myLayerItem.visibleBounds;
// push pageItems to SubLayer constructor/class