-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.js
44 lines (37 loc) · 1.04 KB
/
plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var generateText = function(data, label){
label = label || 'thaana data';
for (var i = 0, l = [selection length]; i < l; i++) {
var layer = selection[i];
var randomData = data[ Math.floor(Math.random() * data.length) ];
if(randomData){
[layer setStringValue: randomData];
[layer setName: label];
}
}
if([selection length] == 0){
alert("A layer must be seleced");
}
};
var generateArticle = function(data, label){
label = label || 'thaana data';
for (var i = 0, l = [selection length]; i < l; i++) {
var layer = selection[i];
var randomData = '';
for(var j=0;j<4;j++){
randomData += data[Math.floor(Math.random() * data.length)]+"\n\n";
}
if(randomData){
[layer setStringValue: randomData];
[layer setName: label];
[layer setStringAlignment: 'right'];
}
}
if([selection length] == 0){
alert("A layer must be seleced");
}
};
function alert(msg, title) {
title = title || "Ooops!!";
var app = [NSApplication sharedApplication];
[app displayDialog:msg withTitle:title];
}