Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
krevlinmen committed Jan 26, 2021
2 parents 4153ba3 + 04a6856 commit 9d33f62
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 84 deletions.
50 changes: 25 additions & 25 deletions Polyfill/prototypes.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/*
/*
<javascriptresource>
<enableinfo>false</enableinfo>
</javascriptresource>
*/


String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
};

String.prototype.startsWith = function (sub) {
if (typeof sub !== "string") throwError("Parameter in startsWith is not a string", sub)
return !sub.length || this.indexOf(sub) === 0
if (typeof sub !== "string")
throwError("Parameter in startsWith is not a string", sub);
return !sub.length || this.indexOf(sub) === 0;
};

String.prototype.endsWith = function (sub) {
if (typeof sub !== "string") throwError("Parameter in endsWith is not a string", sub)
return !sub.length || this.slice(this.length - sub.length).indexOf(sub) === 0
if (typeof sub !== "string")
throwError("Parameter in endsWith is not a string", sub);
return !sub.length || this.slice(this.length - sub.length).indexOf(sub) === 0;
};

String.prototype.endsWithArray = function (subArray) {
for (i in subArray) {
if (this.endsWith(subArray[i]))
return true;
if (this.endsWith(subArray[i])) return true;
}
return false;
};
Expand All @@ -36,21 +36,21 @@ String.prototype.endsWithArray = function (subArray) {
// }

Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
return Object.prototype.toString.call(arg) === "[object Array]";
};

Object.prototype.keys = function () {
const arr = []
for (k in this)
if (this.hasOwnProperty(k))
arr.push(k)
return arr
}

Object.prototype.copy = function () {
const copy = Array.isArray(this) ? [] : {}
for (k in this)
if (this.hasOwnProperty(k))
copy[k] = this[k]
return copy
}
// Object.prototype.keys = function () {
// const arr = []
// for (k in this)
// if (this.hasOwnProperty(k))
// arr.push(k)
// return arr
// }

// Object.prototype.copy = function () {
// const copy = Array.isArray(this) ? [] : {}
// for (k in this)
// if (this.hasOwnProperty(k))
// copy[k] = this[k]
// return copy
// }
76 changes: 37 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
# Layer Format Object

This can be used in `defaultTextFormat`, `customTextFormats`, `starterLayerFormats` and `groupLayer` properties from the configuration file.

### Common Properties

Can be used in any properties from the configuration file.
| Property | Type | Description |
| Property | Type | Description |
| :------------ |:---------------:| :-----|
| name | string | The layer name. |
| visible | boolean | If the layer will be visible or not. |
| allLocked | boolean | Completely block settings and contents of the layer. Will deactivate all 3 below. |
| transparentPixelsLocked | boolean | Edit only opaque portions of the layer. |
| pixelsLocked | boolean | Pixels can't be edited (with a Paint Brush for example). |
| positionLocked | boolean | Layer can't be moved. |
| border | string | Not yet implemented |
| visible | boolean | If the layer will be visible or not. |
| allLocked | boolean | Completely block settings and contents of the layer. Will deactivate all 3 below. |
| transparentPixelsLocked | boolean | Edit only opaque portions of the layer. |
| pixelsLocked | boolean | Pixels can't be edited (with a Paint Brush for example). |
| positionLocked | boolean | Layer can't be moved. |
| border | string | Not yet implemented |

### Text Properties

Can only be used in `defaultTextFormat` and `customTextFormats` from the configuration file.
| Property | Type | Description |
| Property | Type | Description |
| :------------ |:---------------:| :-----|
| identifierStart | string | Can only be used in `customTextFormats` and is **Obrigatory**. Identifies the type of formatting to use in a line of text. Will be ignored if `ignoreCustomWith` identifier was found before this. |
| identifierStart | string | Can only be used in `customTextFormats` and is **Obligatory**. Identifies the type of formatting to use in a line of text. Will be ignored if `ignoreCustomWith` identifier was found before this. |
| size | integer | Font size. |
| font | string | Font name. |
| justification | string | Text justification. See [Documentation](#Documentation) for options. |
| language | string | Text language, useful for auto-wrapping. See [Documentation](#Documentation) for options. |
| boxText | boolean | If true, a TextBox will be used instead of a PointText. |

| font | string | Font name. |
| justification | string | Text justification. See [Documentation](#Documentation) for options. |
| language | string | Text language, useful for auto-wrapping. See [Documentation](#Documentation) for options. |
| boxText | boolean | If true, a TextBox will be used instead of a PointText. |

### Starter Layer Properties

Can only be used in `starterLayerFormats` from the configuration file.
| Property | Type | Description |
| Property | Type | Description |
| :------------ |:---------------:| :-----|
| duplicate | boolean | Is a duplicate from layer below. Can only be used from the 2 layer. |
| isBackgroundLayer | boolean | Turn this layer the background layer. Will override a lot of configurations. |




| isBackgroundLayer | boolean | Turn this layer the background layer. Will override a lot of configurations. |

# Configuration File

This is a commented configuration file as example. **But remember, `.JSON` files CAN'T have comments.**

```javascript
{
// These 3 Configurations determine how we will identify
// a new 'page' in your .txt file:
identifierStart: "[",

identifierStart: "[",
identifierEnd: "]",
ignorePageNumber: false, // This will ignore the number inside indentifiers
ignorePageNumber: false, // This will ignore the number inside identifiers
// This example will identify lines like:
// [1]
// [02]
// [02]
// [ 30 ]
// And will try to find files like
// "01.png", "2.psd", "30.jpeg" to insert this text into


"prioritizePSD": false, // Prioritize '.psd' and '.psb' over the other files
// If have ambiguous files selected like "01.png" and "1.psd"
// There is a order of priorities, that is:
// '.psd', '.psb', '.png', '.jpg', '.jpeg' OR
// '.png', '.jpg', '.jpeg', '.psd', '.psb'


selectAllFiles: false, // With this, you select every file manually, rather than a folder
alwaysCreateGroup: false, // With this, it will always create a folder named by 'groupLayer.name' below

groupLayer: {
name: "Types", // Folder name
visible: false, // Visibility of the layer
},

defaultTextFormat: {
size: 16, // Font size
font: "CCWildWordsInt Regular", // Font name
Expand All @@ -78,16 +78,16 @@ This is a commented configuration file as example. **But remember, `.JSON` files
visible: true, // Visibility of the layer
language: "BRAZILLIANPORTUGUESE", // Language
},



ignoreCustomWith: ".", // Lines starting with this, will always be formatted as default

customTextFormats: [ // You can Add as much 'Layer Format Object's as you want
{
// Necessary:
identifier_Start: "#", // Lines starting with this, will be formatted as following

// Optional:
// Everything not included will be formatted as in default
size: 12,
Expand All @@ -98,15 +98,12 @@ This is a commented configuration file as example. **But remember, `.JSON` files
}
```



# Documentation



This program was made using [Adobe Photoshop 2020 Scripting](https://www.adobe.com/devnet/photoshop/scripting.html) and the javascript documentation can be found there.

Justification Options:

- CENTER
- CENTERJUSTIFIED
- FULLYJUSTIFIED
Expand All @@ -116,6 +113,7 @@ Justification Options:
- RIGHTJUSTIFIED

Language Options:

- BRAZILLIANPORTUGUESE
- CANADIANFRENCH
- DANISH
Expand Down
Loading

0 comments on commit 9d33f62

Please sign in to comment.