Commit 529881c3 authored by rockyl's avatar rockyl

传个版本

parent 163a7995
/**
* Created by rockyl on 2019-11-25.
*/
var mergeFlagReg = /__m$/;
var extName = '.psd';
var oldDocument = app.activeDocument;
var mergeLayers = [];
var document = oldDocument.duplicate(oldDocument.name.replace(extName, '') + '-合并' + extName, 0);
app.activeDocument = document;
merge(document);
function merge(document){
traverse(document, function(layer){
return layer.name.match(mergeFlagReg);
}, function(layer){
document.activeLayer = layer;
var newName = layer.name.replace(mergeFlagReg, '');
layer.name = newName;
mergeLayers.push(newName);
layer.merge();
});
if(mergeLayers.length > 0){
alert('合并的图层有: ' + mergeLayers.join(','));
}else{
alert('没有图层被合并');
}
}
function traverse(layer, filter, callback) {
if(layer.layers){
for (var i = 0; i < layer.layers.length; i++) {
var childLayer = layer.layers[i];
if (filter(childLayer)) {
callback(childLayer);
}else{
traverse(childLayer, filter, callback);
}
}
}
}
/**
* Created by rockyl on 2019-11-25.
*/
var curDocument = app.activeDocument;
//alert(ShowObjProperty2(curDocument.activeLayer).attributes);
//alert(ShowObjProperty2(oldDocument.activeLayer).methods);
for (var i = 0; i < curDocument.layers.length; i++) {
var layer = curDocument.layers[i];
if (!layer.name.match(/__e$/)) {
duplicateToNewDocument(layer);
}
}
function createDocument(width, height, docName) {
//定义一个变量[resolution],表示新文档的分辨率。
var resolution = 72;
//定义一个变量[mode],表示新文档的颜色模式。
var mode = NewDocumentMode.RGB;
//定义一个变量[initialFill],表示新文档的默认背景填充颜色。
var initialFill = DocumentFill.TRANSPARENT;
//定义一个变量[pixelAspectRatio],用来设置新文档的像素比率。
var pixelAspectRatio = 1;
//使用[Documents.add]命令创建一个新文档,将设置好的参数放在[add]方法里面。
var document = app.documents.add(width, height, resolution, docName, mode, initialFill, pixelAspectRatio);
return document;
}
function duplicateToNewDocument(layer) {
var document = createDocument(curDocument.width, curDocument.height, layer.name);
app.activeDocument = curDocument;
layer.duplicate(document, ElementPlacement.PLACEATBEGINNING);
}
function ShowObjProperty2(obj) {
// 用来保存所有的属性名称和值
var attributes = '';
var methods = '';
// 开始遍历
for (var p in obj) {
// 方法
if (typeof (obj[p]) === "function") {
methods += '属性:' + p + '\r\n'
// obj[p]();
} else {
// p 为属性名称,obj[p]为对应属性的值
attributes += '方法:' + p + " = " + obj[p] + "\r\n";
}
}
// 最后显示所有的属性
return {
attributes: attributes,
methods: methods
}
}
/**
* Created by rockyl on 2019-11-25.
*/
var mergeFlagReg = /__m$/;
var excludeFlagReg = /__e$/;
var extName = '.psd';
var oldDocument = app.activeDocument;
var mergeLayers = [];
var document = oldDocument.duplicate(oldDocument.name.replace(extName, '') + '-合并' + extName, 0);
function traverse(layer, callback) {
if (layer.layers) {
for (var i = 0, li = layer.layers.length; i < li; i++) {
var childLayer = layer.layers[i];
var action = callback(childLayer);
switch (action) {
case 0:
traverse(childLayer, callback);
break;
case 2:
i--;
li--;
break;
}
}
}
}
function deleteDocumentAncestorsMetadata() {
whatApp = String(app.name);//String version of the app name
if(whatApp.search("Photoshop") > 0) { //Check for photoshop specifically, or this will cause errors
//Function Scrubs Document Ancestors from Files
if(!documents.length) {
alert("There are no open documents. Please open a file to run this script.")
return;
}
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta( activeDocument.xmpMetadata.rawData);
// Begone foul Document Ancestors!
xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
}
function execute(document) {
traverse(document, function (layer) {
if (layer.name.match(mergeFlagReg)) {
document.activeLayer = layer;
var newName = layer.name.replace(mergeFlagReg, '');
layer.name = newName;
mergeLayers.push(newName);
layer.merge();
return 1;
} else if (layer.name.match(excludeFlagReg)) {
layer.remove();
return 2;
}
return 0;
});
deleteDocumentAncestorsMetadata();
document.crop([0, 0, oldDocument.width, oldDocument.height], 0);
/*if (mergeLayers.length > 0) {
alert('合并的图层有: ' + mergeLayers.join(','));
} else {
alert('没有图层被合并');
}*/
alert('整理完成');
}
execute(document);
......@@ -49,6 +49,9 @@ export async function fetchApi(uri, {params, method = 'get', contentType = 'json
}
const response = await fetch(url, options);
if (response.status === 401) {
location.href = '/admin/permission';
}
const jsonObj = await response.json();
//console.log(jsonObj);
......
......@@ -5,9 +5,9 @@
export let API_HOST;
if (process.env.NODE_ENV === 'development') {
//API_HOST = 'http://10.10.95.74:7777';
API_HOST = 'http://10.10.94.134:7777';
//API_HOST = 'http://10.10.94.134:7777';
//API_HOST = 'http://localhost:3002';
//API_HOST = window.__data.apiHost;
API_HOST = window.__data.apiHost;
} else {
API_HOST = window.__data.apiHost;
}
......
......@@ -11,7 +11,7 @@ export const envStore = {
state: {
initialized: false,
name: 'Zeroing Editor',
version: '1.0.0',
version: '1.0.1',
templates: {
builtin: ['blank'],
custom: [],
......
......@@ -13,6 +13,10 @@
zoom: 0.5;
background: url(data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAiUlEQVQ4jZ1TSxLFIAhLOp7C+19NjyFvlQ7lUUvLRgXzgVGOMQyb6L3/5cwMJAEAxw6sy3FP8tw/EkhJqp7klQMBtKpWcpC1oVp7IoiqviXg4xBFRPL7EM/6WsviYDxwzrkVaBHsz5U4MlWfKxHEySpXIdk6qLRzcXBHVnKQfZRKCy1Ty979XfwApOBe0rB0KiIAAAAASUVORK5CYII=);
background-repeat: repeat;
&::-webkit-scrollbar {
display: none;
}
}
// .zero-playground-draw-panel{
// min-height: 1200px;
......
......@@ -27,6 +27,7 @@
class="file-uploader"
:action="uploadFileUrl"
name="file"
:headers="uploadHeaders"
multiple
:show-file-list="false"
:on-success="uploadFileSuccess"
......@@ -59,6 +60,9 @@
return {
showFields: ['url', 'uuid'],
currentItem: null,
uploadHeaders: {
authorization: 'Bearer ' + window['zeroing_token'],
},
}
},
computed: {
......
<template>
<input-wrapper :editable="editable" :value="value" :container="container" :property="property"
:propertyName="propertyName">
<dynamic-selector style="flex: 1;" :input="value" @input="onChange"
<dynamic-selector style="flex: 1;" :value="value" @input="onChange"
:editable="editable"
:container="container"
:property="property"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment