Beispiel #1
0
    body.delegate('click', '.button-back-to-conf', function(event, element) {
        event.preventDefault();

        var confSelector = $('#configuration-selector'),
            outlineDeleted = body.outlineDeleted,
            currentOutline = confSelector.value();

        ConfNavIndex = ConfNavIndex == -1 ? 1 : ConfNavIndex;
        var navbar = $('#navbar'),
            item = navbar.find('li:nth-child(' + (ConfNavIndex + 1) + ') [data-g5-ajaxify]');

        if (flags.get('pending')) {
            flags.warning({
                callback: function(response, content) {
                    var saveContinue = content.find('[data-g-unsaved-save]'),
                        discardContinue = content.find('[data-g-unsaved-discard]'),
                        flagCallback = function() {
                            flags.off('update:pending', flagCallback);
                            modal.close();

                            body.emit('click', { target: item });
                            navbar.slideDown();
                        };

                    if (!saveContinue) { return; }
                    saveContinue.on('click', function(e) {
                        e.preventDefault();
                        if (this.attribute('disabled')) { return false; }

                        $([saveContinue, discardContinue]).attribute('disabled');
                        flags.on('update:pending', flagCallback);
                        body.emit('click', { target: $('.button-save') });
                    });

                    discardContinue.on('click', function(e) {
                        e.preventDefault();
                        if (this.attribute('disabled')) { return false; }

                        $([saveContinue, discardContinue]).attribute('disabled');
                        flags.set('pending', false);
                        flagCallback();
                    });
                }
            });

            return;
        }

        element.showIndicator();

        if (outlineDeleted == currentOutline) {
            var ids = keys(confSelector.selectizeInstance.Options),
                id = ids.shift();
            body.outlineDeleted = null;
            item.href(item.href().replace('/' + outlineDeleted + '/', '/' + id + '/').replace('style=' + outlineDeleted, 'style=' + id));
        }

        body.emit('click', { target: item });
        navbar.slideDown();
    });
exports.run = function (grunt, task) {

	var
		diff = require("mout/array/difference"),
		keys = require("mout/object/keys"),
		map = require("mout/object/map"),
		blob, value;

	if(!task.data){
		grunt.fail.fatal("Test failed.\nNo test found!'");
		return;
	}

	var diff_result = diff(["dest", "files"], keys(task.data));
	if (!!diff_result.length) {
		grunt.fail.fatal("Test failed.\nMissing properties: '"+diff_result.join("','")+"'.");
		return;
	}

	value = task.data;

	if (!!value.data && !!value.data.indexOf && !!value.data.indexOf("file!"===0)) {
		var file_name = value.data.replace(/^file\!/,"");
		if (grunt.file.exists(file_name)){
			value.data = grunt.file.readJSON(file_name);
		} else {
			grunt.fail.fatal("[page.data]: attempt failed to  file:"+file_name+" failed!");
		}
	}

	if(!!value.raw && value.raw.constructor.name === "Object"){
		value.raw = map(value.raw,function(value){
			if (value.indexOf("file!")===0){
				value = value.replace(/^file\!/,"");
				if (grunt.file.exists(value)){
					return grunt.file.read(value);
				} else {
					grunt.fail.fatal("[page.raw]: attempt failed to  file:"+file_name+" failed!");
				}
			}
			return value;
		});
	}

	blob = grunt.config.get("concat");
	blob[task.target] = {
		src : task.data.files,
		dest : task.data.dest,
		options : task.data.concat_options
	};

	grunt.config.set("concat",blob);
	var to_run = ["concat:"+task.target];
	if (!!task.data.data){
		grunt.config.set("blob-"+task.target,value);
		to_run.push("render-template:"+task.target);
	}
	grunt.task.run(to_run);
};
Beispiel #3
0
        serialData.forEach(function(block) {
            id = keys(block)[0];
            saved = find(saveData, function(data) { return data[id]; });
            current = find(serialData, function(data) { return data[id]; });
            different = !deepEquals(saved, current);

            id = this.builder.get(id);
            if (id) { id.emit('changed', different); }
        }, this);
    return _this.getIds(resourceConfig, options).then( idsMap => {
      var ids = keys(idsMap);
      var tasks = [];

      forEach( ids, id => tasks.push(_this.GET( _this.getIdPath(resourceConfig, options, id) )) );

      return P.all(tasks).then( items => {
        items = compact(items);
        return filter.call( emptyStore, items, resourceConfig.name, params, options );
      });
    });
Beispiel #5
0
var ID = function(options) {
    var map     = options.builder ? keys(options.builder.map) : {},
        type    = options.type,
        subtype = options.subtype,

        result  = [], key, id;

    if (type != 'particle') result.push(type);
    if (subtype)  result.push(subtype);

    key = result.join('-');

    while (id = rand(1000, 9999)) {
        if (!contains(map, key + '-' + id)) {
            break;
        }
    }

    return key + '-' + id;
};
Beispiel #6
0
        request(method, parseAjaxURI(href + getAjaxSuffix()), {}, function(error, response) {
            if (!response.body.success) {
                modal.open({
                    content: response.body.html || response.body,
                    afterOpen: function(container) {
                        if (!response.body.html) { container.style({ width: '90%' }); }
                    }
                });
            } else {
                var confSelector   = $('#configuration-selector'),
                    currentOutline = confSelector.value(),
                    outlineDeleted = response.body.outline,
                    reload         = $('[href="' + getAjaxURL('configurations') + '"]');

                // if the current outline is the one that's been deleted,
                // fallback to default
                if (outlineDeleted && currentOutline == outlineDeleted) {
                    var ids = keys(confSelector.selectizeInstance.Options);
                    if (ids.length) {
                        reload.href(reload.href().replace('style=' + outlineDeleted, 'style=' + ids.shift()));
                    }
                }

                if (!reload) { window.location = window.location; }
                else {
                    body.emit('click', { target: reload });
                }

                toastr.success(response.body.html || 'Action successfully completed.', response.body.title || '');
                if (outlineDeleted) {
                    body.outlineDeleted = outlineDeleted;
                }
            }

            element.hideIndicator();
        });
Beispiel #7
0
 keys: function() {
     return keys(merge(this.properties, this.mutators));
 },
Beispiel #8
0
var amountMap = {
    '4k' : [64, 64, 0.3],
    '8k' : [128, 64, 0.3],
    '16k' : [128, 128, 0.3],
    '32k' : [256, 128, 0.5],
    '65k' : [256, 256, 0.6],
    '131k' : [512, 256, 0.65],
    '252k' : [512, 512, 0.7],
    '524k' : [1024, 512, 0.75],
    '1m' : [1024, 1024, 0.8],
    '2m' : [2048, 1024, 0.85],
    '4m' : [2048, 2048, 0.9]
};

exports.amountList = keys(amountMap);
query.amount = amountMap[query.amount] ? query.amount : '16k';
var amountInfo = amountMap[query.amount];
exports.simulatorTextureWidth = amountInfo[0];
exports.simulatorTextureHeight = amountInfo[1];

exports.emitterDistanceRatio = 0.65;
exports.emitterSpeed = 20.0;

exports.volumeWidth = 256;
exports.volumeHeight = 128;
exports.volumeDepth = 128;
exports.volumeSliceColumn = 8;
exports.volumeSliceRow = 16;
exports.volumeScale = 7;
Beispiel #9
0
// need restart
exports.useStats = false;
exports.textureSize = 128;
exports.lineAmount = 65536;

// lines
exports.followMouse = false;
exports.constraintRatio = 0.07;
exports.useWhiteNodes = false;
exports.whiteNodesRatio = 1;

exports.useReflectedGround = true;

exports.isWhite = false;
exports.whiteRatio = 0;


exports.fxaa = false;
var motionBlurQualityMap = exports.motionBlurQualityMap = {
    best: 1,
    high: 0.5,
    medium: 1 / 3,
    low: 0.25
};
exports.motionBlurQualityList = keys(motionBlurQualityMap);
query.motionBlurQuality = motionBlurQualityMap[query.motionBlurQuality] ? query.motionBlurQuality : 'high';
exports.motionBlur = false;
exports.motionBlurPause = false;
exports.bloom = false;
Beispiel #10
0
 getCandidates(field){
   return keys(this.data[field] || {})
 }
Beispiel #11
0
 getAllFiled(){
   return keys(this.data);
 }