Commit 22165923 authored by Sergey Antonovich's avatar Sergey Antonovich 🇯🇵

custom-button.conf

parent 83beb018
<?xml version="1.0" encoding="utf-8"?>
<configuration version="1" date="2018-03-29 17:03:00" synergyVersion="3.15">
<objects version="1" date="2018-03-29 17:03:00" synergyVersion="3.15">
<customComponent code="button" name="button by [0x00034]" use_in_forms="true">
<javascript>/*
Example code:
model.setValue('Простая кнопка');
model.click = function(){
console.log('click');
};
model.mousedown = function(){
console.log('mousedown');
};
model.mouseup = function(){
console.log('mouseup');
};
model.mouseenter = function(){
console.log('mouseenter');
};
model.mouseleave = function(){
console.log('mouseleave');
};
##
# Events:
##
click - При клике
mousedown - При зажатие
mouseup - После отжатия
mouseenter - При наведении
mouseleave - После наведения
Code by yandexphp
*/
model.getAsfData = function (blockNumber) {
if(model.getValue()){
var valueObject = JSON.stringify(model.getValue());
return AS.FORMS.ASFDataUtils.getBaseAsfData(model.asfProperty, blockNumber, valueObject, valueObject);
}else{
return AS.FORMS.ASFDataUtils.getBaseAsfData(model.asfProperty, blockNumber);
}
};
model.setAsfData = function(asfData){
if(!asfData || !asfData.value) return;
model.setValue(JSON.parse(asfData.value));
};
$(view.container).find('.GNTJMDODMR').hover(
function(){$(this).addClass('GNTJMDODPO');},
function(){$(this).removeClass('GNTJMDODPO');}
);
view.updateValueFromModel = function(){
['click','mousedown','mouseup','mouseenter','mouseleave'].forEach(function(item){
if((item in model) === false) return;
$(view.container).find('.custom-button-synergy').off(item);
$(view.container).find('.custom-button-synergy').on(item,model[item]);
});
if(model.getValue()) $(view.container).find('span').text(""+model.getValue());
};
view.updateValueFromModel();</javascript>
<html>&lt;div class="GNTJMDODHJ GNTJMDODMR custom-button-synergy" style="width: 100%;cursor:pointer;"&gt;&lt;div class="GNTJMDODNJ GNTJMDODDO" style="font-size: 0px; overflow: hidden; padding: 0px;margin: 0 7px 0 7px;"&gt;&lt;span class="GNTJMDODDO"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</html>
</customComponent>
</objects>
<dependencies/>
</configuration>
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