How to use this.init method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

jsb_create_apis.js

Source:jsb_create_apis.js Github

copy

Full Screen

...27 ************************************************************/28var _p;29/************************  Layers  *************************/30var dummyCtor = function(){31    this.init();32};33_p = cc.Layer.prototype;34_p._ctor = function() {35    cc.Layer.prototype.init.call(this);36};37_p = cc.LayerColor.prototype;38_p._ctor = function(color, w, h) {39    color = color ||  cc.color(0, 0, 0, 255);40    w = w === undefined ? cc.winSize.width : w;41    h = h === undefined ? cc.winSize.height : h;42    cc.LayerColor.prototype.init.call(this, color, w, h);43};44_p = cc.LayerGradient.prototype;45_p._ctor = function(start, end, v, colorStops) {46    start = start || cc.color(0,0,0,255);47    end = end || cc.color(0,0,0,255);48    v = v || cc.p(0, -1);49    this.initWithColor(start, end, v);50    if (colorStops instanceof Array) {51        cc.log('Warning: Color stops parameter is not supported in JSB.');52    }53};54_p = cc.LayerMultiplex.prototype;55_p._ctor = function(layers) {56    if(layers !== undefined){57        if (layers instanceof Array)58            cc.LayerMultiplex.prototype.initWithArray.call(this, layers);59        else60            cc.LayerMultiplex.prototype.initWithArray.call(this, Array.prototype.slice.call(arguments));61    }else{62        cc.LayerMultiplex.prototype.init.call(this);63    }64};65/************************  Sprite  *************************/66_p = cc.Sprite.prototype;67_p._ctor = function(fileName, rect) {68    if (fileName === undefined) {69        cc.Sprite.prototype.init.call(this);70    }71    else if (typeof(fileName) === 'string') {72        if (fileName[0] === '#') {73            //init with a sprite frame name74            var frameName = fileName.substr(1, fileName.length - 1);75            this.initWithSpriteFrameName(frameName);76        } else {77            // Create with filename and rect78            rect ? this.initWithFile(fileName, rect) : this.initWithFile(fileName);79        }80    }81    else if (typeof(fileName) === 'object') {82        if (fileName instanceof cc.Texture2D) {83            //init with texture and rect84            rect ? this.initWithTexture(fileName, rect) : this.initWithTexture(fileName);85        } else if (fileName instanceof cc.SpriteFrame) {86            //init with a sprite frame87            this.initWithSpriteFrame(fileName);88        } else if (fileName instanceof jsb.PolygonInfo) {89            //init with a polygon info90            this.initWithPolygon(fileName);91        }92    }93};94_p = cc.SpriteBatchNode.prototype;95_p._ctor = function(fileImage, capacity) {96    capacity = capacity || cc.SpriteBatchNode.DEFAULT_CAPACITY;97    if (typeof(fileImage) == 'string')98        this.initWithFile(fileImage, capacity);99    else100        this.initWithTexture(fileImage, capacity);101};102_p = cc.SpriteFrame.prototype;103_p._ctor = function(filename, rect, rotated, offset, originalSize){104    if(originalSize !== undefined){105        if(filename instanceof cc.Texture2D)106            this.initWithTexture(filename, rect, rotated, offset, originalSize);107        else108            this.initWithTexture(filename, rect, rotated, offset, originalSize);109    }else if(rect !== undefined){110        if(filename instanceof cc.Texture2D)111            this.initWithTexture(filename, rect);112        else113            this.initWithTextureFilename(filename, rect);114    }115};116/*****************************  effect   *******************************/117_p = cc.GridBase.prototype;118_p._ctor = function(gridSize, texture, flipped){119    if(gridSize !== undefined)120        this.initWithSize(gridSize, texture, flipped);121};122_p = cc.Grid3D.prototype;123_p._ctor = function(gridSize, texture, flipped){124    if(gridSize !== undefined)125        this.initWithSize(gridSize, texture, flipped);126};127_p = cc.TiledGrid3D.prototype;128_p._ctor = function(gridSize, texture, flipped){129    if(gridSize !== undefined)130        this.initWithSize(gridSize, texture, flipped);131};132/************************  Menu and menu items  *************************/133_p = cc.Menu.prototype;134_p._ctor = function(menuItems) {135    if((arguments.length > 0) && (arguments[arguments.length-1] == null))136        cc.log('parameters should not be ending with null in Javascript');137    var argc = arguments.length,138        items = [];139    if (argc == 1) {140        if (menuItems instanceof Array) {141            items = menuItems;142        }143        else{144            items.push(arguments[0]);145        }146    }147    else if (argc > 1) {148        for (var i = 0; i < argc; i++) {149            if (arguments[i])150                items.push(arguments[i]);151        }152    }153    if(items && items.length > 0)154        this.initWithArray(items);155    else156        this.init();157};158_p = cc.MenuItem.prototype;159_p._ctor = function(callback, target) {160    callback && this.initWithCallback(callback.bind(target));161};162_p = cc.MenuItemLabel.prototype;163_p._ctor = function(label, callback, target) {164    callback = callback ? callback.bind(target) : null;165    label && this.initWithLabel(label, callback);166};167_p = cc.MenuItemAtlasFont.prototype;168_p._ctor = function(value, charMapFile, itemWidth, itemHeight, startCharMap, callback, target) {169    callback = callback ? callback.bind(target) : null;170    value !== undefined && this.initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, callback);171};172_p = cc.MenuItemFont.prototype;173_p._ctor = function(value, callback, target) {174    callback = callback ? callback.bind(target) : null;175    value !== undefined && this.initWithString(value, callback);176};177_p = cc.MenuItemSprite.prototype;178_p._ctor = function(normalSprite, selectedSprite, three, four, five) {179    if (normalSprite) {180        normalSprite = normalSprite;181        selectedSprite = selectedSprite || null;182        var disabledSprite, target, callback;183        if (five) {184            disabledSprite = three;185            callback = four;186            target = five;187        } else if (four && typeof four === 'function') {188            disabledSprite = three;189            callback = four;190        } else if (four && typeof three === 'function') {191            target = four;192            callback = three;193            disabledSprite = normalSprite;194        } else if (three === undefined) {195            disabledSprite = normalSprite;196        }197        callback = callback ? callback.bind(target) : null;198        this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback);199    }200};201_p = cc.MenuItemImage.prototype;202_p._ctor = function(normalImage, selectedImage, three, four, five) {203    var disabledImage = null,204        callback = null,205        target = null;206    if (normalImage === undefined) {207        cc.MenuItemImage.prototype.init.call(this);208    }209    else {210        if (four === undefined)  {211            callback = three;212        }213        else if (five === undefined) {214            if (typeof three === 'function') {215                callback = three;216                target = four;217            }218            else {219                disabledImage = three;220                callback = four;221            }222        }223        else if (five) {224            disabledImage = three;225            callback = four;226            target = five;227        }228        callback = callback ? callback.bind(target) : null;229        var normalSprite = new cc.Sprite(normalImage);230        var selectedSprite = new cc.Sprite(selectedImage);231        var disabledSprite = disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage);232        this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback);233    }234};235_p = cc.MenuItemToggle.prototype;236_p._ctor = function() {237    var argc =  arguments.length, callback, target;238    // passing callback.239    if (typeof arguments[argc-2] === 'function') {240        callback = arguments[argc-2];241        target = arguments[argc-1];242        argc = argc - 2;243    } else if(typeof arguments[argc-1] === 'function'){244        callback = arguments[argc-1];245        argc = argc - 1;246    }247    if(argc > 0) {248        this.initWithItem(arguments[0]);249        for (var i = 1; i < argc; i++) {250            if (arguments[i])251                this.addSubItem(arguments[i]);252        }253        if (callback)254            target ? this.setCallback(callback, target) : this.setCallback(callback);255    }256    else {257        callback = callback ? callback.bind(target) : null;258        this.initWithCallback(callback);259    }260};261/************************  motion-streak  *************************/262_p = cc.MotionStreak.prototype;263_p._ctor = function(fade, minSeg, stroke, color, texture){264    if(texture !== undefined)265        this.initWithFade(fade, minSeg, stroke, color, texture);266};267/************************  Particle  *************************/268_p = cc.ParticleBatchNode.prototype;269_p._ctor = function(fileImage, capacity){270    capacity = capacity || cc.PARTICLE_DEFAULT_CAPACITY;271    if (typeof(fileImage) == 'string') {272        cc.ParticleBatchNode.prototype.init.call(this, fileImage, capacity);273    } else if (fileImage instanceof cc.Texture2D) {274        this.initWithTexture(fileImage, capacity);275    }276};277_p = cc.ParticleSystem.prototype;278_p._ctor = function(plistFile){279    if (!plistFile || typeof(plistFile) === 'number') {280        var ton = plistFile || 100;281        this.initWithTotalParticles(ton);282    } else if ( typeof plistFile === 'string') {283        this.initWithFile(plistFile);284    } else if(plistFile){285        this.initWithDictionary(plistFile);286    }287};288cc.ParticleFire.prototype._ctor = dummyCtor;289cc.ParticleFireworks.prototype._ctor = dummyCtor;290cc.ParticleSun.prototype._ctor = dummyCtor;291cc.ParticleGalaxy.prototype._ctor = dummyCtor;292cc.ParticleMeteor.prototype._ctor = dummyCtor;293cc.ParticleFlower.prototype._ctor = dummyCtor;294cc.ParticleSpiral.prototype._ctor = dummyCtor;295cc.ParticleExplosion.prototype._ctor = dummyCtor;296cc.ParticleSmoke.prototype._ctor = dummyCtor;297cc.ParticleRain.prototype._ctor = dummyCtor;298cc.ParticleSnow.prototype._ctor = dummyCtor;299/************************  ProgressTimer  *************************/300_p = cc.ProgressTimer.prototype;301_p._ctor = function(sprite){302    sprite !== undefined && this.initWithSprite(sprite);303};304/************************  TextFieldTTF  *************************/305_p = cc.TextFieldTTF.prototype;306_p._ctor = function(placeholder, dimensions, alignment, fontName, fontSize){307    if(fontSize !== undefined){308        this.initWithPlaceHolder('', dimensions, alignment, fontName, fontSize);309        if(placeholder)310            this._placeHolder = placeholder;311    }312    else if(fontName === undefined && alignment !== undefined){313        fontName = arguments[1];314        fontSize = arguments[2];315        this.initWithString('', fontName, fontSize);316        if(placeholder)317            this._placeHolder = placeholder;318    }319};320/************************  RenderTexture  *************************/321_p = cc.RenderTexture.prototype;322_p._ctor = function(width, height, format, depthStencilFormat){323    if(width !== undefined && height !== undefined){324        format = format || cc.Texture2D.PIXEL_FORMAT_RGBA8888;325        depthStencilFormat = depthStencilFormat || 0;326        this.initWithWidthAndHeight(width, height, format, depthStencilFormat);327    }328};329/************************  Tile Map  *************************/330_p = cc.TileMapAtlas.prototype;331_p._ctor = function(tile, mapFile, tileWidth, tileHeight){332    if(tileHeight !== undefined)333        this.initWithTileFile(tile, mapFile, tileWidth, tileHeight);334};335_p = cc.TMXLayer.prototype;336_p._ctor = function(tilesetInfo, layerInfo, mapInfo){337    if(mapInfo !== undefined)338        this.initWithTilesetInfo(tilesetInfo, layerInfo, mapInfo);339};340_p = cc.TMXTiledMap.prototype;341_p._ctor = function(tmxFile, resourcePath){342    if(resourcePath !== undefined){343        this.initWithXML(tmxFile,resourcePath);344    }else if(tmxFile !== undefined){345        this.initWithTMXFile(tmxFile);346    }347};348_p = cc.TMXMapInfo.prototype;349_p._ctor = function(tmxFile, resourcePath){350    if (resourcePath !== undefined) {351        this.initWithXML(tmxFile,resourcePath);352    }else if(tmxFile !== undefined){353        this.initWithTMXFile(tmxFile);354    }355};356/************************  TransitionScene  *************************/357_p = cc.TransitionScene.prototype;358_p._ctor = function(t, scene){359    if(t !== undefined && scene !== undefined)360        this.initWithDuration(t, scene);361};362_p = cc.TransitionSceneOriented.prototype;363_p._ctor = function(t, scene, orientation){364    orientation != undefined && this.initWithDuration(t, scene, orientation);365};366_p = cc.TransitionPageTurn.prototype;367_p._ctor = function(t, scene, backwards){368    backwards != undefined && this.initWithDuration(t, scene, backwards);369};370/************************  Actions  *************************/371cc.Speed.prototype._ctor = function(action, speed) {372    speed !== undefined && this.initWithAction(action, speed);373};374cc.Follow.prototype._ctor = function (followedNode, rect) {375    if(followedNode)376        rect ? this.initWithTarget(followedNode, rect)377             : this.initWithTarget(followedNode);378};379cc.OrbitCamera.prototype._ctor = function (t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX) {380    deltaAngleX !== undefined && this.initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX);381};382cc.CardinalSplineTo.prototype._ctor = cc.CardinalSplineBy.prototype._ctor = function(duration, points, tension) {383    tension !== undefined && this.initWithDuration(duration, points, tension);384};385cc.CatmullRomTo.prototype._ctor = cc.CatmullRomBy.prototype._ctor = function(dt, points) {386    points !== undefined && this.initWithDuration(dt, points);387};388var easeCtor = function(action) {389    action !== undefined && this.initWithAction(action);390};391cc.ActionEase.prototype._ctor = easeCtor;392cc.EaseExponentialIn.prototype._ctor = easeCtor;393cc.EaseExponentialOut.prototype._ctor = easeCtor;394cc.EaseExponentialInOut.prototype._ctor = easeCtor;395cc.EaseSineIn.prototype._ctor = easeCtor;396cc.EaseSineOut.prototype._ctor = easeCtor;397cc.EaseSineInOut.prototype._ctor = easeCtor;398cc.EaseBounce.prototype._ctor = easeCtor;399cc.EaseBounceIn.prototype._ctor = easeCtor;400cc.EaseBounceOut.prototype._ctor = easeCtor;401cc.EaseBounceInOut.prototype._ctor = easeCtor;402cc.EaseBackIn.prototype._ctor = easeCtor;403cc.EaseBackOut.prototype._ctor = easeCtor;404cc.EaseBackInOut.prototype._ctor = easeCtor;405var easeRateCtor = function(action, rate) {406    rate !== undefined && this.initWithAction(action, rate);407};408cc.EaseRateAction.prototype._ctor = easeRateCtor;409cc.EaseIn.prototype._ctor = easeRateCtor;410cc.EaseOut.prototype._ctor = easeRateCtor;411cc.EaseInOut.prototype._ctor = easeRateCtor;412var easeElasticCtor = function(action, period) {413    if( action ) {414        period !== undefined ? this.initWithAction(action, period)415                             : this.initWithAction(action);416    }417};418cc.EaseElastic.prototype._ctor = easeElasticCtor;419cc.EaseElasticIn.prototype._ctor = easeElasticCtor;420cc.EaseElasticOut.prototype._ctor = easeElasticCtor;421cc.EaseElasticInOut.prototype._ctor = easeElasticCtor;422cc.ReuseGrid.prototype._ctor = function(times) {423    times !== undefined && this.initWithTimes(times);424};425var durationCtor = function(duration, gridSize) {426    gridSize && this.initWithDuration(duration, gridSize);427};428cc.GridAction.prototype._ctor = durationCtor;429cc.Grid3DAction.prototype._ctor = durationCtor;430cc.TiledGrid3DAction.prototype._ctor = durationCtor;431cc.PageTurn3D.prototype._ctor = durationCtor;432cc.FadeOutTRTiles.prototype._ctor = durationCtor;433cc.FadeOutBLTiles.prototype._ctor = durationCtor;434cc.FadeOutUpTiles.prototype._ctor = durationCtor;435cc.FadeOutDownTiles.prototype._ctor = durationCtor;436cc.Twirl.prototype._ctor = function(duration, gridSize, position, twirls, amplitude) {437    amplitude !== undefined && this.initWithDuration(duration, gridSize, position, twirls, amplitude);438};439cc.Waves.prototype._ctor = function(duration, gridSize, waves, amplitude, horizontal, vertical) {440    vertical !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical);441};442cc.Liquid.prototype._ctor = function(duration, gridSize, waves, amplitude) {443    amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);444};445cc.Shaky3D.prototype._ctor = function(duration, gridSize, range, shakeZ) {446    shakeZ !== undefined && this.initWithDuration(duration, gridSize, range, shakeZ);447};448cc.Ripple3D.prototype._ctor = function(duration, gridSize, position, radius, waves, amplitude) {449    amplitude !== undefined && this.initWithDuration(duration, gridSize, position, radius, waves, amplitude);450};451cc.Lens3D.prototype._ctor = function(duration, gridSize, position, radius) {452    radius !== undefined && this.initWithDuration(duration, gridSize, position, radius);453};454cc.FlipY3D.prototype._ctor = cc.FlipX3D.prototype._ctor = function(duration) {455    duration !== undefined && this.initWithDuration(duration, cc.size(1, 1));456};457cc.Waves3D.prototype._ctor = function(duration, gridSize, waves, amplitude) {458    amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);459};460cc.RemoveSelf.prototype._ctor = function(isNeedCleanUp) {461    isNeedCleanUp !== undefined && cc.RemoveSelf.prototype.init.call(this, isNeedCleanUp);462};463cc.FlipX.prototype._ctor = function(flip) {464    flip !== undefined && this.initWithFlipX(flip);465};466cc.FlipY.prototype._ctor = function(flip) {467    flip !== undefined && this.initWithFlipY(flip);468};469cc.Place.prototype._ctor = function(pos, y) {470    if (pos !== undefined) {471        if (pos.x !== undefined) {472            y = pos.y;473            pos = pos.x;474        }475        this.initWithPosition(cc.p(pos, y));476    }477};478cc.CallFunc.prototype._ctor = function(selector, selectorTarget, data) {479    if(selector !== undefined){480        if(selectorTarget === undefined)481            this.initWithFunction(selector);482        else this.initWithFunction(selector, selectorTarget, data);483    }484};485cc.ActionInterval.prototype._ctor = function(d) {486    d !== undefined && this.initWithDuration(d);487};488cc.Sequence.prototype._ctor = function(tempArray) {489    var paramArray = (tempArray instanceof Array) ? tempArray : arguments;490    var last = paramArray.length - 1;491    if ((last >= 0) && (paramArray[last] == null))492        cc.log('parameters should not be ending with null in Javascript');493    if (last >= 0) {494        var prev = paramArray[0];495        for (var i = 1; i < last; i++) {496            if (paramArray[i]) {497                prev = cc.Sequence.create(prev, paramArray[i]);498            }499        }500        this.initWithTwoActions(prev, paramArray[last]);501    }502};503cc.Repeat.prototype._ctor = function(action, times) {504    times !== undefined && this.initWithAction(action, times);505};506cc.RepeatForever.prototype._ctor = function(action) {507    action !== undefined && this.initWithAction(action);508};509cc.Spawn.prototype._ctor = function(tempArray) {510    var paramArray = (tempArray instanceof Array) ? tempArray : arguments;511    var last = paramArray.length - 1;512    if ((last >= 0) && (paramArray[last] == null))513        cc.log('parameters should not be ending with null in Javascript');514    if (last >= 0) {515        var prev = paramArray[0];516        for (var i = 1; i < last; i++) {517            if (paramArray[i]) {518                prev = cc.Spawn.create(prev, paramArray[i]);519            }520        }521        this.initWithTwoActions(prev, paramArray[last]);522    }523};524cc.RotateTo.prototype._ctor = cc.RotateBy.prototype._ctor = function(duration, deltaAngleX, deltaAngleY) {525    if (deltaAngleX !== undefined) {526        if (deltaAngleY !== undefined)527            this.initWithDuration(duration, deltaAngleX, deltaAngleY);528        else529            this.initWithDuration(duration, deltaAngleX, deltaAngleX);530    }531};532cc.MoveBy.prototype._ctor = cc.MoveTo.prototype._ctor = function(duration, pos, y) {533    if (pos !== undefined) {534        if(pos.x === undefined) {535            pos = cc.p(pos, y);536        }537        this.initWithDuration(duration, pos);538    }539};540cc.SkewTo.prototype._ctor = cc.SkewBy.prototype._ctor = function(t, sx, sy) {541    sy !== undefined && this.initWithDuration(t, sx, sy);542};543cc.JumpBy.prototype._ctor = cc.JumpTo.prototype._ctor = function(duration, position, y, height, jumps) {544    if (height !== undefined) {545        if (jumps !== undefined) {546            position = cc.p(position, y);547        }548        else {549            jumps = height;550            height = y;551        }552        this.initWithDuration(duration, position, height, jumps);553    }554};555cc.BezierBy.prototype._ctor = cc.BezierTo.prototype._ctor = function(t, c) {556    c !== undefined && this.initWithDuration(t, c);557};558cc.ScaleTo.prototype._ctor = cc.ScaleBy.prototype._ctor = function(duration, sx, sy) {559    if (sx !== undefined) {560        if (sy !== undefined)561            this.initWithDuration(duration, sx, sy);562        else this.initWithDuration(duration, sx);563    }564};565cc.Blink.prototype._ctor = function(duration, blinks) {566    blinks !== undefined && this.initWithDuration(duration, blinks);567};568cc.FadeTo.prototype._ctor = function(duration, opacity) {569    opacity !== undefined && this.initWithDuration(duration, opacity);570};571cc.FadeIn.prototype._ctor = function(duration) {572    duration !== undefined && this.initWithDuration(duration, 255);573};574cc.FadeOut.prototype._ctor = function(duration) {575    duration !== undefined && this.initWithDuration(duration, 0);576};577cc.TintTo.prototype._ctor = cc.TintBy.prototype._ctor = function(duration, red, green, blue) {578    blue !== undefined && this.initWithDuration(duration, red, green, blue);579};580cc.DelayTime.prototype._ctor = function(duration) {581    duration !== undefined && this.initWithDuration(duration);582};583/*584cc.ReverseTime.prototype._ctor = function(action) {585    action && this.initWithAction(action);586};*/587cc.Animate.prototype._ctor = function(animation) {588    animation && this.initWithAnimation(animation);589};590cc.TargetedAction.prototype._ctor = function(target, action) {591    action && this.initWithTarget(target, action);592};593cc.ProgressTo.prototype._ctor = function(duration, percent) {594    percent !== undefined && this.initWithDuration(duration, percent);595};596cc.ProgressFromTo.prototype._ctor = function(duration, fromPercentage, toPercentage) {597    toPercentage !== undefined && this.initWithDuration(duration, fromPercentage, toPercentage);598};599cc.SplitCols.prototype._ctor = cc.SplitRows.prototype._ctor = function(duration, rowsCols) {600    rowsCols !== undefined && this.initWithDuration(duration, rowsCols);601};602cc.JumpTiles3D.prototype._ctor = function(duration, gridSize, numberOfJumps, amplitude) {603    amplitude !== undefined && this.initWithDuration(duration, gridSize, numberOfJumps, amplitude);604};605cc.WavesTiles3D.prototype._ctor = function(duration, gridSize, waves, amplitude) {606    amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);607};608cc.TurnOffTiles.prototype._ctor = function(duration, gridSize, seed) {609    if (gridSize !== undefined) {610        seed = seed || 0;611        this.initWithDuration(duration, gridSize, seed);612    }613};614cc.ShakyTiles3D.prototype._ctor = function(duration, gridSize, range, shakeZ) {615    shakeZ !== undefined && this.initWithDuration(duration, gridSize, range, shakeZ);616};617cc.ShatteredTiles3D.prototype._ctor = function(duration, gridSize, range, shatterZ) {618    shatterZ !== undefined && this.initWithDuration(duration, gridSize, range, shatterZ);619};620cc.ShuffleTiles.prototype._ctor = function(duration, gridSize, seed) {621    seed !== undefined && this.initWithDuration(duration, gridSize, seed);622};623cc.ActionTween.prototype._ctor = function(duration, key, from, to) {624    to !== undefined && this.initWithDuration(duration, key, from, to);625};626cc.Animation.prototype._ctor = function(frames, delay, loops) {627    if (frames === undefined) {628        this.init();629    } else {630        var frame0 = frames[0];631        delay = delay === undefined ? 0 : delay;632        loops = loops === undefined ? 1 : loops;633        if(frame0){634            if (frame0 instanceof cc.SpriteFrame) {635                //init with sprite frames , delay and loops.636                this.initWithSpriteFrames(frames, delay, loops);637            }else if(frame0 instanceof cc.AnimationFrame) {638                //init with sprite frames , delay and loops.639                this.initWithAnimationFrames(frames, delay, loops);640            }641        }642    }...

Full Screen

Full Screen

slick.editors.js

Source:slick.editors.js Github

copy

Full Screen

...71        valid: true,72        msg: null73      };74    };75    this.init();76  }77  function IntegerEditor(args) {78    var $input;79    var defaultValue;80    var scope = this;81    this.init = function () {82      $input = $("<INPUT type=text class='editor-text' />");83      $input.bind("keydown.nav", function (e) {84        if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) {85          e.stopImmediatePropagation();86        }87      });88      $input.appendTo(args.container);89      $input.focus().select();90    };91    this.destroy = function () {92      $input.remove();93    };94    this.focus = function () {95      $input.focus();96    };97    this.loadValue = function (item) {98      defaultValue = item[args.column.field];99      $input.val(defaultValue);100      $input[0].defaultValue = defaultValue;101      $input.select();102    };103    this.serializeValue = function () {104      return parseInt($input.val(), 10) || 0;105    };106    this.applyValue = function (item, state) {107      item[args.column.field] = state;108    };109    this.isValueChanged = function () {110      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);111    };112    this.validate = function () {113      if (isNaN($input.val())) {114        return {115          valid: false,116          msg: "Please enter a valid integer"117        };118      }119      return {120        valid: true,121        msg: null122      };123    };124    this.init();125  }126  function DateEditor(args) {127    var $input;128    var defaultValue;129    var scope = this;130    var calendarOpen = false;131    this.init = function () {132      $input = $("<INPUT type=text class='editor-text' />");133      $input.appendTo(args.container);134      $input.focus().select();135      $input.datepicker({136        showOn: "button",137        buttonImageOnly: true,138        buttonImage: "../images/calendar.gif",139        beforeShow: function () {140          calendarOpen = true141        },142        onClose: function () {143          calendarOpen = false144        }145      });146      $input.width($input.width() - 18);147    };148    this.destroy = function () {149      $.datepicker.dpDiv.stop(true, true);150      $input.datepicker("hide");151      $input.datepicker("destroy");152      $input.remove();153    };154    this.show = function () {155      if (calendarOpen) {156        $.datepicker.dpDiv.stop(true, true).show();157      }158    };159    this.hide = function () {160      if (calendarOpen) {161        $.datepicker.dpDiv.stop(true, true).hide();162      }163    };164    this.position = function (position) {165      if (!calendarOpen) {166        return;167      }168      $.datepicker.dpDiv169          .css("top", position.top + 30)170          .css("left", position.left);171    };172    this.focus = function () {173      $input.focus();174    };175    this.loadValue = function (item) {176      defaultValue = item[args.column.field];177      $input.val(defaultValue);178      $input[0].defaultValue = defaultValue;179      $input.select();180    };181    this.serializeValue = function () {182      return $input.val();183    };184    this.applyValue = function (item, state) {185      item[args.column.field] = state;186    };187    this.isValueChanged = function () {188      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);189    };190    this.validate = function () {191      return {192        valid: true,193        msg: null194      };195    };196    this.init();197  }198  function YesNoSelectEditor(args) {199    var $select;200    var defaultValue;201    var scope = this;202    this.init = function () {203      $select = $("<SELECT tabIndex='0' class='editor-yesno'><OPTION value='yes'>Yes</OPTION><OPTION value='no'>No</OPTION></SELECT>");204      $select.appendTo(args.container);205      $select.focus();206    };207    this.destroy = function () {208      $select.remove();209    };210    this.focus = function () {211      $select.focus();212    };213    this.loadValue = function (item) {214      $select.val((defaultValue = item[args.column.field]) ? "yes" : "no");215      $select.select();216    };217    this.serializeValue = function () {218      return ($select.val() == "yes");219    };220    this.applyValue = function (item, state) {221      item[args.column.field] = state;222    };223    this.isValueChanged = function () {224      return ($select.val() != defaultValue);225    };226    this.validate = function () {227      return {228        valid: true,229        msg: null230      };231    };232    this.init();233  }234  function CheckboxEditor(args) {235    var $select;236    var defaultValue;237    var scope = this;238    this.init = function () {239      $select = $("<INPUT type=checkbox value='true' class='editor-checkbox' hideFocus>");240      $select.appendTo(args.container);241      $select.focus();242    };243    this.destroy = function () {244      $select.remove();245    };246    this.focus = function () {247      $select.focus();248    };249    this.loadValue = function (item) {250      defaultValue = item[args.column.field];251      if (defaultValue) {252        $select.attr("checked", "checked");253      } else {254        $select.removeAttr("checked");255      }256    };257    this.serializeValue = function () {258      return $select.attr("checked");259    };260    this.applyValue = function (item, state) {261      item[args.column.field] = state;262    };263    this.isValueChanged = function () {264      return ($select.attr("checked") != defaultValue);265    };266    this.validate = function () {267      return {268        valid: true,269        msg: null270      };271    };272    this.init();273  }274  function PercentCompleteEditor(args) {275    var $input, $picker;276    var defaultValue;277    var scope = this;278    this.init = function () {279      $input = $("<INPUT type=text class='editor-percentcomplete' />");280      $input.width($(args.container).innerWidth() - 25);281      $input.appendTo(args.container);282      $picker = $("<div class='editor-percentcomplete-picker' />").appendTo(args.container);283      $picker.append("<div class='editor-percentcomplete-helper'><div class='editor-percentcomplete-wrapper'><div class='editor-percentcomplete-slider' /><div class='editor-percentcomplete-buttons' /></div></div>");284      $picker.find(".editor-percentcomplete-buttons").append("<button val=0>Not started</button><br/><button val=50>In Progress</button><br/><button val=100>Complete</button>");285      $input.focus().select();286      $picker.find(".editor-percentcomplete-slider").slider({287        orientation: "vertical",288        range: "min",289        value: defaultValue,290        slide: function (event, ui) {291          $input.val(ui.value)292        }293      });294      $picker.find(".editor-percentcomplete-buttons button").bind("click", function (e) {295        $input.val($(this).attr("val"));296        $picker.find(".editor-percentcomplete-slider").slider("value", $(this).attr("val"));297      })298    };299    this.destroy = function () {300      $input.remove();301      $picker.remove();302    };303    this.focus = function () {304      $input.focus();305    };306    this.loadValue = function (item) {307      $input.val(defaultValue = item[args.column.field]);308      $input.select();309    };310    this.serializeValue = function () {311      return parseInt($input.val(), 10) || 0;312    };313    this.applyValue = function (item, state) {314      item[args.column.field] = state;315    };316    this.isValueChanged = function () {317      return (!($input.val() == "" && defaultValue == null)) && ((parseInt($input.val(), 10) || 0) != defaultValue);318    };319    this.validate = function () {320      if (isNaN(parseInt($input.val(), 10))) {321        return {322          valid: false,323          msg: "Please enter a valid positive number"324        };325      }326      return {327        valid: true,328        msg: null329      };330    };331    this.init();332  }333  /*334   * An example of a "detached" editor.335   * The UI is added onto document BODY and .position(), .show() and .hide() are implemented.336   * KeyDown events are also handled to provide handling for Tab, Shift-Tab, Esc and Ctrl-Enter.337   */338  function LongTextEditor(args) {339    var $input, $wrapper;340    var defaultValue;341    var scope = this;342    this.init = function () {343      var $container = $("body");344      $wrapper = $("<DIV style='z-index:10000;position:absolute;background:white;padding:5px;border:3px solid gray; -moz-border-radius:10px; border-radius:10px;'/>")345          .appendTo($container);346      $input = $("<TEXTAREA hidefocus rows=5 style='backround:white;width:250px;height:80px;border:0;outline:0'>")347          .appendTo($wrapper);348      $("<DIV style='text-align:right'><BUTTON>Save</BUTTON><BUTTON>Cancel</BUTTON></DIV>")349          .appendTo($wrapper);350      $wrapper.find("button:first").bind("click", this.save);351      $wrapper.find("button:last").bind("click", this.cancel);352      $input.bind("keydown", this.handleKeyDown);353      scope.position(args.position);354      $input.focus().select();355    };356    this.handleKeyDown = function (e) {357      if (e.which == $.ui.keyCode.ENTER && e.ctrlKey) {358        scope.save();359      } else if (e.which == $.ui.keyCode.ESCAPE) {360        e.preventDefault();361        scope.cancel();362      } else if (e.which == $.ui.keyCode.TAB && e.shiftKey) {363        e.preventDefault();364        args.grid.navigatePrev();365      } else if (e.which == $.ui.keyCode.TAB) {366        e.preventDefault();367        args.grid.navigateNext();368      }369    };370    this.save = function () {371      args.commitChanges();372    };373    this.cancel = function () {374      $input.val(defaultValue);375      args.cancelChanges();376    };377    this.hide = function () {378      $wrapper.hide();379    };380    this.show = function () {381      $wrapper.show();382    };383    this.position = function (position) {384      $wrapper385          .css("top", position.top - 5)386          .css("left", position.left - 5)387    };388    this.destroy = function () {389      $wrapper.remove();390    };391    this.focus = function () {392      $input.focus();393    };394    this.loadValue = function (item) {395      $input.val(defaultValue = item[args.column.field]);396      $input.select();397    };398    this.serializeValue = function () {399      return $input.val();400    };401    this.applyValue = function (item, state) {402      item[args.column.field] = state;403    };404    this.isValueChanged = function () {405      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);406    };407    this.validate = function () {408      return {409        valid: true,410        msg: null411      };412    };413    this.init();414  }...

Full Screen

Full Screen

ProtocolHelpers.js

Source:ProtocolHelpers.js Github

copy

Full Screen

1Protocol.AVL05 = JClass(Protocol.Common,{2	STATIC: {3    },4	constructor: function(arg) {5    	this.initDeviceInfo(arg);6		this.posInfo = {};7    },8    initPosInfoEx: function (ary, posInfo) {9        posInfo.fuel = ary[25];10    },11    initHisPosInfoEx: function (ary, posInfo) {12        posInfo.fuel = ary[23];13    }14});15Protocol.ClassManager.add("AVL05", Protocol.AVL05);16Protocol.AVL09 = JClass(Protocol.Common,{17	STATIC: {18    },19	constructor: function(arg) {20    	this.initDeviceInfo(arg);21		this.posInfo = {};22    },23    initPosInfoEx: function (ary, posInfo) {24        posInfo.rfid = ary[23];25        posInfo.drivingTime = ary[24];26    },27    initHisPosInfoEx: function (ary, posInfo) {28        posInfo.rfid = ary[21];29        posInfo.drivingTime = ary[22];30    }31});32Protocol.ClassManager.add("AVL09", Protocol.AVL09);33Protocol.EELINK_OBD = JClass(Protocol.Common,{34	STATIC: {35    },36	constructor: function(arg) {37    	this.initDeviceInfo(arg);38		this.posInfo = {};39    },40    initPosInfoEx:function(ary, posInfo){41        posInfo.RPM = ary[23];42        posInfo.IAT = ary[24];43        posInfo.DTC = ary[25];44        posInfo.MPG = ary[26];45    },46    initHisPosInfoEx:function(ary, posInfo){47        posInfo.RPM = ary[21];48        posInfo.IAT = ary[22];49        posInfo.DTC = ary[23];50        posInfo.MPG = ary[24];51    }52});53Protocol.ClassManager.add("EELINK_OBD", Protocol.EELINK_OBD);54Protocol.GOT10 = JClass(Protocol.Common,{55	STATIC: {56    },57	constructor: function(arg) {58    	this.initDeviceInfo(arg);59		this.posInfo = {};60    },61    initPosInfoEx:function(ary, posInfo){62        posInfo.RPM = ary[23];63        posInfo.IAT = ary[24];64        posInfo.DTC = ary[25];65        posInfo.MPG = ary[26];66    },67    initHisPosInfoEx:function(ary, posInfo){68        posInfo.RPM = ary[21];69        posInfo.IAT = ary[22];70        posInfo.DTC = ary[23];71        posInfo.MPG = ary[24];72    }73});74Protocol.ClassManager.add("GOT10", Protocol.GOT10);75Protocol.HONGYUAN = JClass(Protocol.Common,{76	STATIC: {77    },78	constructor: function(arg) {79    	this.initDeviceInfo(arg);80		this.posInfo = {};81    },82    initPosInfoEx:function(ary, posInfo){83        posInfo.LaunchHours2 = ary[23];84    },85    initHisPosInfoEx:function(ary, posInfo){86        //posInfo.Battery = ary[21];87    }88});89Protocol.ClassManager.add("HONGYUAN", Protocol.HONGYUAN);90Protocol.HONGYUAN_V = JClass(Protocol.Common,{91	STATIC: {92    },93	constructor: function(arg) {94    	this.initDeviceInfo(arg);95		this.posInfo = {};96    },97    initPosInfoEx:function(ary, posInfo){98        posInfo.LaunchHours2 = ary[23];99    },100    initHisPosInfoEx:function(ary, posInfo){101        //posInfo.Battery = ary[21];102    }103});104Protocol.ClassManager.add("HONGYUAN_V", Protocol.HONGYUAN_V);105Protocol.RUPTELA = JClass(Protocol.Common,{106	STATIC: {107    },108	constructor: function(arg) {109    	this.initDeviceInfo(arg);110		this.posInfo = {};111    },112    initPosInfoEx: function (ary, posInfo) {113        posInfo.alt = ary[24];114        posInfo.rfid = ary[25];115    },116    initHisPosInfoEx: function (ary, posInfo) {117        posInfo.alt = ary[22];118        posInfo.rfid = ary[23];119    }120});121Protocol.ClassManager.add("RUPTELA", Protocol.RUPTELA);122Protocol.TIANQIN_LK3G = JClass(Protocol.Common,{123	STATIC: {124    },125	constructor: function(arg) {126    	this.initDeviceInfo(arg);127		this.posInfo = {};128    },129    initPosInfoEx:function(ary, posInfo){130        posInfo.Battery = ary[23];131    },132    initHisPosInfoEx:function(ary, posInfo){133        posInfo.Battery = ary[21];134    }135});136Protocol.ClassManager.add("TIANQIN_LK3G", Protocol.TIANQIN_LK3G);137Protocol.TIANQIN_QT206 = JClass(Protocol.Common,{138	STATIC: {139    },140	constructor: function(arg) {141    	this.initDeviceInfo(arg);142		this.posInfo = {};143    },144    initPosInfoEx:function(ary, posInfo){145        posInfo.Battery = ary[23];146    },147    initHisPosInfoEx:function(ary, posInfo){148        posInfo.Battery = ary[21];149    }150});151Protocol.ClassManager.add("TIANQIN_QT206", Protocol.TIANQIN_QT206);152Protocol.TIANQIN_QT525 = JClass(Protocol.Common,{153	STATIC: {154    },155	constructor: function(arg) {156    	this.initDeviceInfo(arg);157		this.posInfo = {};158    },159    initPosInfoEx:function(ary, posInfo){160        posInfo.LaunchHours2 = ary[23];161    },162    initHisPosInfoEx:function(ary, posInfo){163        //posInfo.Battery = ary[21];164    }165});166Protocol.ClassManager.add("TIANQIN_QT525", Protocol.TIANQIN_QT525);167Protocol.TIANQIN_QTPTW = JClass(Protocol.Common,{168	STATIC: {169    },170	constructor: function(arg) {171    	this.initDeviceInfo(arg);172		this.posInfo = {};173    },174    initPosInfoEx:function(ary, posInfo){175        posInfo.Battery = ary[23];176    },177    initHisPosInfoEx:function(ary, posInfo){178        posInfo.Battery = ary[21];179    }180});181Protocol.ClassManager.add("TIANQIN_QTPTW", Protocol.TIANQIN_QTPTW);182Protocol.VJOY = JClass(Protocol.Common,{183    STATIC: {184    },185    constructor: function(arg) {186        this.initDeviceInfo(arg);187        this.posInfo = {};188    },189    initPosInfoEx:function(ary, posInfo){190        posInfo.BatteryVoltage = ary[23];191        posInfo.ChargeVoltage = ary[24];192        posInfo.Battery = (ary[25]/ 6 ) * 100;193    },194    initHisPosInfoEx:function(ary, posInfo){195        posInfo.BatteryVoltage = ary[21];196        posInfo.ChargeVoltage = ary[22];197        posInfo.Battery = (ary[23]/ 6 ) * 100;198    }199});200Protocol.ClassManager.add("VJOY", Protocol.VJOY);201Protocol.VT600 = JClass(Protocol.Common,{202	STATIC: {203    },204	constructor: function(arg) {205    	this.initDeviceInfo(arg);206		this.posInfo = {};207    },208	initPosInfoEx: function (ary, posInfo) {209	    posInfo.fuel = ary[24];210        posInfo.alt = ary[25];211        posInfo.rfid = ary[26];212    },213    initHisPosInfoEx: function (ary, posInfo) {214        posInfo.fuel = ary[22];215        posInfo.alt = ary[23];216        posInfo.rfid = ary[24];217    }218});219Protocol.ClassManager.add("VT600", Protocol.VT600);220Protocol.VT600_FUEL = JClass(Protocol.Common,{221	STATIC: {222    },223	constructor: function(arg) {224    	this.initDeviceInfo(arg);225		this.posInfo = {};226    },227	initPosInfoEx: function (ary, posInfo) {228	    posInfo.fuel = ary[24];229	    posInfo.alt = ary[25];230	    posInfo.rfid = ary[26];231	},232	initHisPosInfoEx: function (ary, posInfo) {233	    posInfo.fuel = ary[22];234	    posInfo.alt = ary[23];235	    posInfo.rfid = ary[24];236	}237});238Protocol.ClassManager.add("VT600_FUEL", Protocol.VT600_FUEL);239Protocol.SINOCASTEL = JClass(Protocol.Common,{240    STATIC: {241    },242    constructor: function(arg) {243        this.initDeviceInfo(arg);244        this.posInfo = {};245    },246    initPosInfoEx:function(ary, posInfo){247        posInfo.RPM = ary[23];248        posInfo.IAT = ary[24];249        posInfo.DTC = ary[25];250        posInfo.MPG = ary[26];251    },252    initHisPosInfoEx:function(ary, posInfo){253        posInfo.RPM = ary[21];254        posInfo.IAT = ary[22];255        posInfo.DTC = ary[23];256        posInfo.MPG = ary[24];257    }258});259Protocol.ClassManager.add("SINOCASTEL", Protocol.SINOCASTEL);260Protocol.VT600_3G = JClass(Protocol.Common,{261    STATIC: {262    },263    constructor: function(arg) {264        this.initDeviceInfo(arg);265        this.posInfo = {};266    },267    initPosInfoEx: function (ary, posInfo) {268        posInfo.fuel = ary[24];269        posInfo.alt = ary[25];270        posInfo.rfid = ary[26];271    },272    initHisPosInfoEx: function (ary, posInfo) {273        posInfo.fuel = ary[22];274        posInfo.alt = ary[23];275        posInfo.rfid = ary[24];276    }277});278Protocol.ClassManager.add("VT600_3G", Protocol.VT600_3G);279Protocol.BSJV3 = JClass(Protocol.Common,{280	STATIC: {281    },282	constructor: function(arg) {283    	this.initDeviceInfo(arg);284		this.posInfo = {};285    },286    initPosInfoEx:function(ary, posInfo){287        posInfo.Battery = ary[23];288    },289    initHisPosInfoEx:function(ary, posInfo){290        posInfo.Battery = ary[21];291    }292});293Protocol.ClassManager.add("BSJV3", Protocol.BSJV3);294Protocol.JT808_GLOCK = JClass(Protocol.Common,{295    STATIC: {296    },297    constructor: function(arg) {298        this.initDeviceInfo(arg);299        this.posInfo = {};300    },301    initPosInfoEx:function(ary, posInfo){302        posInfo.Battery = ary[23];303    },304    initHisPosInfoEx:function(ary, posInfo){305        posInfo.Battery = ary[21];306    }307});308Protocol.ClassManager.add("JT808_GLOCK", Protocol.JT808_GLOCK);309Protocol.JT808_KMXXX = JClass(Protocol.Common,{310	STATIC: {311    },312	constructor: function(arg) {313    	this.initDeviceInfo(arg);314		this.posInfo = {};315    },316    initPosInfoEx:function(ary, posInfo){317        posInfo.LaunchHours2 = ary[23];318    },319    initHisPosInfoEx:function(ary, posInfo){320        //posInfo.Battery = ary[21];321    } 322      323});...

Full Screen

Full Screen

window_effects.js

Source:window_effects.js Github

copy

Full Screen

1Effect.ResizeWindow = Class.create();2Object.extend(Object.extend(Effect.ResizeWindow.prototype, Effect.Base.prototype), {3  initialize: function(win, top, left, width, height) {4    this.window = win;5    this.window.resizing = true;6    7    var size = win.getSize();8    this.initWidth    = parseFloat(size.width);9    this.initHeight   = parseFloat(size.height);10    var location = win.getLocation();11    this.initTop    = parseFloat(location.top);12    this.initLeft   = parseFloat(location.left);13    this.width    = width != null  ? parseFloat(width)  : this.initWidth;14    this.height   = height != null ? parseFloat(height) : this.initHeight;15    this.top      = top != null    ? parseFloat(top)    : this.initTop;16    this.left     = left != null   ? parseFloat(left)   : this.initLeft;17    this.dx     = this.left   - this.initLeft;18    this.dy     = this.top    - this.initTop;19    this.dw     = this.width  - this.initWidth;20    this.dh     = this.height - this.initHeight;21    22    this.r2      = $(this.window.getId() + "_row2");23    this.content = $(this.window.getId() + "_content");24        25    this.contentOverflow = this.content.getStyle("overflow") || "auto";26    this.content.setStyle({overflow: "hidden"});27    28    // Wired mode29    if (this.window.options.wiredDrag) {30      this.window.currentDrag = win._createWiredElement();31      this.window.currentDrag.show();32      this.window.element.hide();33    }34    this.start(arguments[5]);35  },36  37  update: function(position) {38    var width  = Math.floor(this.initWidth  + this.dw * position);39    var height = Math.floor(this.initHeight + this.dh * position);40    var top    = Math.floor(this.initTop    + this.dy * position);41    var left   = Math.floor(this.initLeft   + this.dx * position);42    if (window.ie) {43      if (Math.floor(height) == 0)  44        this.r2.hide();45      else if (Math.floor(height) >1)  46        this.r2.show();47    }      48    this.r2.setStyle({height: height});49    this.window.setSize(width, height);50    this.window.setLocation(top, left);51  },52  53  finish: function(position) {54    // Wired mode55    if (this.window.options.wiredDrag) {56      this.window._hideWiredElement();57      this.window.element.show();58    }59    this.window.setSize(this.width, this.height);60    this.window.setLocation(this.top, this.left);61    this.r2.setStyle({height: null});62    63    this.content.setStyle({overflow: this.contentOverflow});64      65    this.window.resizing = false;66  }67});68Effect.ModalSlideDown = function(element) {69  var windowScroll = WindowUtilities.getWindowScroll();    70  var height = element.getStyle("height");  71  element.setStyle({top: - (parseFloat(height) - windowScroll.top) + "px"});72  73  element.show();74  return new Effect.Move(element, Object.extend({ x: 0, y: parseFloat(height) }, arguments[1] || {}));75};76Effect.ModalSlideUp = function(element) {77  var height = element.getStyle("height");78  return new Effect.Move(element, Object.extend({ x: 0, y: -parseFloat(height) }, arguments[1] || {}));79};80PopupEffect = Class.create();81PopupEffect.prototype = {    82  initialize: function(htmlElement) {83    this.html = $(htmlElement);      84    this.options = Object.extend({className: "popup_effect", duration: 0.4}, arguments[1] || {});85    86  },87  show: function(element, options) { 88    var position = Position.cumulativeOffset(this.html);      89    var size = this.html.getDimensions();90    var bounds = element.win.getBounds();91    this.window =  element.win;      92    // Create a div93    if (!this.div) {94      this.div = document.createElement("div");95      this.div.className = this.options.className;96      this.div.style.height = size.height + "px";97      this.div.style.width  = size.width  + "px";98      this.div.style.top    = position[1] + "px";99      this.div.style.left   = position[0] + "px";   100      this.div.style.position = "absolute"101      document.body.appendChild(this.div);102    }                                                   103    if (this.options.fromOpacity)104      this.div.setStyle({opacity: this.options.fromOpacity})105    this.div.show();          106    var style = "top:" + bounds.top + ";left:" +bounds.left + ";width:" + bounds.width +";height:" + bounds.height;107    if (this.options.toOpacity)108      style += ";opacity:" + this.options.toOpacity;109    110    new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._showWindow.bind(this)});    111  },112  hide: function(element, options) {     113    var position = Position.cumulativeOffset(this.html);      114    var size = this.html.getDimensions();    115    this.window.visible = true; 116    var bounds = this.window.getBounds();117    this.window.visible = false; 118    this.window.element.hide();119    this.div.style.height = bounds.height;120    this.div.style.width  = bounds.width;121    this.div.style.top    = bounds.top;122    this.div.style.left   = bounds.left;123    124    if (this.options.toOpacity)125      this.div.setStyle({opacity: this.options.toOpacity})126    this.div.show();                                 127    var style = "top:" + position[1] + "px;left:" + position[0] + "px;width:" + size.width +"px;height:" + size.height + "px";128    if (this.options.fromOpacity)129      style += ";opacity:" + this.options.fromOpacity;130    new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._hideDiv.bind(this)});    131  },132  133  _showWindow: function() {134    this.div.hide();135    this.window.element.show(); 136  },137  138  _hideDiv: function() {139    this.div.hide();140  }...

Full Screen

Full Screen

jsb_ext_create_apis.js

Source:jsb_ext_create_apis.js Github

copy

Full Screen

...25 * Constructors with built in init function26 *27 ************************************************************/28jsb.EventListenerAssetsManager.prototype._ctor = function(assetsManager, callback) {29    callback !== undefined && this.init(assetsManager, callback);30};31cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize, fontName, autoSizeWithLabel ){32    if (autoSizeWithLabel !== undefined && backgroundSprite) {33        this.initWithLabelAndBackgroundSprite(label, backgroundSprite, autoSizeWithLabel);34    }35    else if(fontName !== undefined && fontSize !== undefined) {36        this.initWithTitleAndFontNameAndFontSize(label, fontName, fontSize);37    }38    else if(backgroundSprite !== undefined) {39        this.initWithLabelAndBackgroundSprite(label, backgroundSprite, true);40    }41    else if(label !== undefined) {42        this.initWithBackgroundSprite(label);43    }44    else {45        this.init();46    }47};48cc.ControlColourPicker.prototype._ctor = function(){49    this.init();50};51cc.ControlPotentiometer.prototype._ctor = function(backgroundFile, progressFile, thumbFile){52    if (thumbFile != undefined) {53        // Prepare track for potentiometer54        var backgroundSprite = cc.Sprite.create(backgroundFile);55        // Prepare thumb for potentiometer56        var thumbSprite = cc.Sprite.create(thumbFile);57        // Prepare progress for potentiometer58        var progressTimer = cc.ProgressTimer.create(cc.Sprite.create(progressFile));59        this.initWithTrackSprite_ProgressTimer_ThumbSprite(backgroundSprite, progressTimer, thumbSprite);60    }61};62cc.ControlSlider.prototype._ctor = function(bgFile, progressFile, thumbFile){63    if (thumbFile != undefined) {64        // Prepare background for slider65        bgSprite = cc.Sprite.create(bgFile);66        // Prepare progress for slider67        progressSprite = cc.Sprite.create(progressFile);68        // Prepare thumb (menuItem) for slider69        thumbSprite = cc.Sprite.create(thumbFile);70        this.initWithSprites(bgSprite, progressSprite, thumbSprite);71    }72};73cc.ControlStepper.prototype._ctor = function(minusSprite, plusSprite){74    plusSprite !== undefined && this.initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite);75};76cc.ControlSwitch.prototype._ctor = function(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel){77    offLabel !== undefined && this.initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);78};79cc.TableView.prototype._ctor = function(dataSouurce, size, container){80    container == undefined ? this._init(dataSouurce, size) : this._init(dataSouurce, size, container);81};82cc.ScrollView.prototype._ctor = function(size, container) {83    size == undefined ? this.init() : (container ? this.initWithViewSize(size, container) : this.initWithViewSize(size));...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2driver.init({3}).then(function() {4  return driver.elementByAccessibilityId('Graphics').click();5}).then(function() {6  return driver.elementByAccessibilityId('Arcs').click();7}).then(function() {8  return driver.elementsByClassName('android.widget.EditText');9}).then(function(elements) {10  return elements[1].sendKeys('Appium User');11}).then(function() {12  return driver.elementByClassName('android.widget.Button').click();13}).then(function() {14  return driver.sleep(3000);15}).then(function() {16  return driver.quit();17}).done();

Full Screen

Using AI Code Generation

copy

Full Screen

1var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;2var AppiumAndroidDriver = new AppiumAndroidDriver();3AppiumAndroidDriver.init();4AppiumAndroidDriver.quit();5AppiumAndroidDriver.startLogcat();6AppiumAndroidDriver.stopLogcat();7AppiumAndroidDriver.getLogcatLogs();8var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;9var AppiumAndroidDriver = new AppiumAndroidDriver();10AppiumAndroidDriver.init();11AppiumAndroidDriver.quit();12AppiumAndroidDriver.startLogcat();13AppiumAndroidDriver.stopLogcat();14AppiumAndroidDriver.getLogcatLogs();15var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;16var AppiumAndroidDriver = new AppiumAndroidDriver();17AppiumAndroidDriver.init();18AppiumAndroidDriver.quit();19AppiumAndroidDriver.startLogcat();20AppiumAndroidDriver.stopLogcat();21AppiumAndroidDriver.getLogcatLogs();22var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;23var AppiumAndroidDriver = new AppiumAndroidDriver();24AppiumAndroidDriver.init();25AppiumAndroidDriver.quit();26AppiumAndroidDriver.startLogcat();27AppiumAndroidDriver.stopLogcat();28AppiumAndroidDriver.getLogcatLogs();29var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;30var AppiumAndroidDriver = new AppiumAndroidDriver();31AppiumAndroidDriver.init();32AppiumAndroidDriver.quit();33AppiumAndroidDriver.startLogcat();34AppiumAndroidDriver.stopLogcat();35AppiumAndroidDriver.getLogcatLogs();36var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;37var AppiumAndroidDriver = new AppiumAndroidDriver();38AppiumAndroidDriver.init();39AppiumAndroidDriver.quit();40AppiumAndroidDriver.startLogcat();41AppiumAndroidDriver.stopLogcat();42AppiumAndroidDriver.getLogcatLogs();43var AppiumAndroidDriver = require('appium-android-driver').AndroidDriver;44var AppiumAndroidDriver = new AppiumAndroidDriver();45AppiumAndroidDriver.init();

Full Screen

Using AI Code Generation

copy

Full Screen

1Now if you want to use the Appium Android Driver, you can just import the Appium Android Driver and use its init method like below:2import { AndroidDriver } from '@appium/base-driver';3Now if you want to use the Appium IOS Driver, you can just import the Appium IOS Driver and use its init method like below:4import { IOSDriver } from '@appium/base-driver';5Now if you want to use the Appium Windows Driver, you can just import the Appium Windows Driver and use its init method like below:6import { WindowsDriver } from '@appium/base-driver';7Now if you want to use the Appium Mac Driver, you can just import the Appium Mac Driver and use its init method like below:8import { MacDriver } from '@appium/base-driver';9Now that you have imported the Appium Android Driver, Appium IOS Driver, Appium Windows Driver, Appium Mac Driver, you can use its init method like below:10import { AndroidDriver } from '@appium/base-driver';11import { IOSDriver } from '@appium/base-driver';12import { WindowsDriver } from '@appium/base-driver';13import { MacDriver } from '@appium/base-driver';

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = new AndroidDriver();2driver.init();3TypeError: undefined is not a function (evaluating 'this.init()')4TypeError: undefined is not a function (evaluating 'this.init()')5TypeError: undefined is not a function (evaluating 'this.init()')6TypeError: undefined is not a function (evaluating 'this.init()')7TypeError: undefined is not a function (evaluating 'this.init()')8TypeError: undefined is not a function (evaluating 'this.init()')9TypeError: undefined is not a function (evaluating 'this.init()')10TypeError: undefined is not a function (evaluating '

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Android Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful