Best JavaScript code snippet using protractor
common.js
Source:common.js  
1var isPhone = (window.navigator.platform != "Win32");2var isAndroid = (window.navigator.userAgent.indexOf('Android')>=0)?true : false;3function logs(m){4    uexLog.sendLog(m);5}6 function isDefine(para) {7    if ( typeof para == 'undefined' || para == "" || para == "[]" || para == null || para == undefined || para == 'undefined'|| para == '[]')8        return false;9    else10        return true;11}12//è·å年份//è·åæä»½//è·åæ¥æ13function NYR(date,flag){14    var da=new Date(date);15    if(isDefine(flag)){16        if(flag==1){17            return da.getFullYear()+"-"+((da.getMonth()+1)<10?"0"+(da.getMonth()+1):(da.getMonth()+1))+"-"+(da.getDate()<10?"0"+da.getDate():da.getDate());18        }else{19            return ((da.getMonth()+1)<10?"0"+(da.getMonth()+1):(da.getMonth()+1))+"-"+(da.getDate()<10?"0"+da.getDate():da.getDate());20        }21        22    }else{23        return da.getFullYear()+"å¹´"+((da.getMonth()+1)<10?"0"+(da.getMonth()+1):(da.getMonth()+1))+"æ"+(da.getDate()<10?"0"+da.getDate():da.getDate())+"æ¥";24    }    25}26//è·åå°æ¶//è·åå27function HM(date){28    var da=new Date(date);29    var hour=da.getHours();30    if(hour<10){31        hour="0"+hour;32    }33    var minutes=da.getMinutes();34    if(minutes<10){35        minutes="0"+minutes;36    }37    return hour+":"+minutes38}39/**40 * å»é¤å符串ä¸ç空格41 * @param String42 */43function trim(str){ //å é¤å·¦å³ä¸¤ç«¯ç空格44    return str.replace(/(^\s*)|(\s*$)/g, "");45}46//æªåå符串47function  subStr(str){48  var len=trim(str).length;  49  var s="";50   if(len>4){51       s=trim(str).substring(0,3);52       return s;  53   } else{54       s=str;55       return s; 56   }57}58//æªå页é¢å符59function csubstr(str,s,e){60    var r='';61    if(typeof(str)!='string'){62        return str;63    }64    var l=str.length;65    if(e>l*2){66        return str;67    }68    for(var i=0;i<l;i++){69        if(s>i)continue;70        if(str.charCodeAt(i)>255){ //è¿åæå®ä½ç½®çUnicode71            if( e == 1 ){//å©ä¸ä¸ªå符72                r=r+"...";73                return r;74            }  75            e=e-2;76        }else{           77            e--;78        }79        if(str.charAt(i)==undefined){//鲿¢å弿º¢åº80            return r;81        }82        r=r+str.charAt(i);  //å符å串ã83        if(e<=0){84            r=r+"...";85            return r;86        }87    }88    return r;89}90  function  getGroupId(node){//éè¿ç¾¤å表ä¸çid è·å群æå      注æ ï¼ç¾¤å表æ¯éè¿èç¹è·åå¾å°ç¾¤id 91       var list= localStorage.getItem("groupList");92       var listObj = (JSON.parse(list)).msg.grouplist;93      // var groupNode = appcan.getLocVal("groupNode");    94       for(var i=0;i<listObj.length;i++){95           if((listObj[i].groupname).toLowerCase() ==node.toLowerCase()){             96               localStorage.setItem("groupId",listObj[i].groupid);  //群id97               var param = {98                    groupid:listObj[i].groupid,                    //  群ID99                    imId: localStorage.getItem("simcere.runtime.imUserId")                      //  ç¨æ·ID100               }101              appcan.window.publish("E_GROUP_MEM_ROLE",param);102               break;103                    104           }else{105           }106       } 107}108function leftGroupHtml(dataList,selfImg1,i,flag,userId_name,copyId){109   //flag为0代表æ¯è天记å½;1代表çå¬å°å¥½ååçæ°æ¶æ¯110    var flags = flag;111     if(flags == 0){112       //æ¶æ¯ç±»åï¼1-ææ¬ï¼2-å¾çï¼3-è¯é³ï¼113        var datatype = dataList[i].msgType;114        //è¯é³å·²è¯»åæªè¯»çç¶æ115        var voiceStatus = dataList[i].voiceStatus;116        var content = dataList[i].content;117        var fileUrl = dataList[i].resPath;118        var senderId = dataList[i].msgSender;119        var userName =userId_name[senderId].userName;120        var msgtimess = dataList[i].voiceTime;121        var msgId = dataList[i].msgId;122    } else {123        var datatype = dataList.msgType;124        var voiceStatus = 3;125        var msgId = dataList.msgId;126        var content = dataList.content;127        var fileUrl = dataList.resPath;128        var senderId = dataList.msgSender;129        var userName =userId_name[senderId].userName;130        var msgtimess = dataList.voiceTime;131        var msgtimess = Number(msgtimess);132        if (msgtimess <= 3) {133            var yywidth = 3.5;134        } else if (3 < msgtimess <= 60) {135            var yywidth = 3.5 + (msgtimess - 3) * 0.1;136        }137    }138    139   switch(parseInt(datatype)){140       141      case 1:142        var str = '<div class="ub hhuinn-tb ">' + 143                    '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + 144                    '<div class="ub-f1 ub hhkuinn-l ub-ver">'+145                        '<div class=" ub umar-b "><div class="ulev-1">'+userName+'</div></div>'+146                         '<div id="'+ copyId +'" class="ub-f1 ub">' +147                           '<div class="hhjiantou huihuajiantoul ub-img-r lft"></div>' + 148                           '<div class=" ub hhuinn bg-wh hhuc-a">'+149                             '<div id="'+ i +'" class="gz-ulev hhline-hei bc-text ub ub-ac umw2 umh3 hx copyMessage">' + content + '</div>'+150                                '</div>' +                               151                              '</div>' +152                            '</div>' +153                           '<div class="ub-f200"></div>'+                           154                         '</div>';  155       break;156     case 2:157        var str = '<div class="ub hhuinn-tb ">' +158                     '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' +159                       '<div class="ub-f1 ub hhkuinn-l ub-ver">'+160                           '<div class=" ub umar-b ">'+161                                 '<div class="ulev-1">'+userName+'</div>'+162                            '</div>' + 163                           '<div class="ub-f1 ub">'+164                             '<div class="hhjiantou huihuajiantoul ub-img-r posiright lft"></div>' +165                             '<div class="ub piclist"  id="tp_'+msgId+'" tpsrc="'+fileUrl+'">' + 166                                  '<div class=" ub-img1 ub-f1 hhuc-a hhuba1 hhumaxwh1" style="background-image:url('+fileUrl+') !important;opacity: 0.4;display:block;" id="'+msgId+'">'+167                                      '<div class="ub ub-ac ub-pc ub-img huihuaunload1 bai" style="height:2em;margin-top:2.75em;color:#7B7777;"></div>'+168                                  '</div>' +169                           '</div>'+170                         '</div>' +171                       '</div>' + 172                     '<div class="ub-f200"></div>' + '</div>';                  173     break;174     175    case 3:176        switch (parseInt(voiceStatus)){177           case 1: 178             var str = '<div class="ub hhuinn-tb " >'+179                        '<div class="iconwh  ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + 180                        '<div class="ub-f1 ub hhkuinn-l ub-ver">'+181                          '<div class=" ub umar-b ">'+182                            '<div class="ulev-1">'+userName+'</div></div>' +183                          '<div class=" ub duifshengyin audioPlay" id="'+msgId+'">' + 184                            '<div class="uhide dz" flag="0">' + fileUrl + '</div>' +185                            '<div class="uhide tian">' + msgId + '</div>' + 186                            '<div class="hhjiantou huihuajiantoul ub-img-r lft"></div>' + 187                            '<div class=" ub yuyinduihua hhuc-a bg-wh hhuinn" id="dddd' + i + '">' + 188                              '<div class="ub ub-ac">' + '<div class="yuyin ub-img"></div>' +189                              '<div id="yuyinlen" class="aaaaa gzt-green ulev-1 uinn4 " >' + msgtimess +190                               '</div>' + 191                            '</div>' + 192                            '<div class="gzt-green" style="width: 0.4375em;height: 0.4375em;">\'\'</div>' + 193                           '</div><div class="yuand ub-img"></div>' + 194                         '</div>'  + '</div>' + '<div class="ub-f200"></div>' + '</div>';195            196            break;197            198          case 2: 199             var str = '<div class="ub hhuinn-tb " >' +200                        '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' +201                         '<div class="ub-f1 ub hhkuinn-l ub-ver">'+202                           '<div class=" ub umar-b ">'+203                            '<div class="ulev-1">'+userName+'</div></div>' + 204                            '<div class=" ub duifshengyin audioPlay" id="'+msgId+'">' + 205                            '<div class="uhide dz" flag="0">' + fileUrl + '</div>' +206                            '<div class="uhide tian">'+msgId+'</div>'+ 207                             '<div class="hhjiantou huihuajiantoul ub-img-r lft"></div>' + 208                             '<div class=" ub yuyinduihua hhuc-a bg-wh hhuinn" id="dddd' + i + '">' + 209                             '<div class="ub ub-ac">' + '<div class="yuyin ub-img"></div>' +210                              '<div id="yuyinlen" class="aaaaa gzt-green ulev-1 uinn4 " >' + msgtimess + '</div>' + '</div>' +211                               '<div class="gzt-green" style="width: 0.4375em;height: 0.4375em;">\'\'</div>' + '</div>' + '</div></div>' + 212                               '<div class="ub-f200"></div>' + '</div>';213            214            break;215            216          case 3: 217              var str = '<div class="ub hhuinn-tb " >' + 218                    '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + 219                    '<div class="ub-f1 ub hhkuinn-l ub-ver">'+220                         '<div class=" ub umar-b ">'+221                             '<div class="ulev-1">'+userName+'</div>'+                             222                          '</div>' + 223                    '<div class=" ub duifshengyin audioPlay" id="'+msgId+'">' + 224                       '<div class="uhide dz" flag="0">' + fileUrl+ '</div>' +225                       '<div class="uhide tian">'+msgId+'</div>'+ 226                       '<div class="hhjiantou huihuajiantoul ub-img-r lft"></div>' + 227                       '<div class=" ub yuyinduihua hhuc-a bg-wh hhuinn" style="width:'+yywidth+'em;">' + 228                          '<div class="ub ub-ac">' +229                              '<div class="yuyin ub-img"></div>' +230                              '<div id="yuyinlen" class="aaaaa gzt-green ulev-1 uinn4 gzuinn-l" >' + msgtimess + '</div>' +231                          '</div>' + 232                          '<div class="gzt-green" style="width: 0.4375em;height: 0.4375em;">\'\'</div>' +233                       '</div>' +234                       '<div class="yuand ub-img"></div>'+ '</div>'  + '</div>' + '<div class="ub-f200"></div>' + '</div>';                    235            236            break;    237            238             239            240            241        }242       243     break;244 245 246   }247    248 return str;   249    250}251function rightHtml(dataList,selfImg1,i){252  //æ¶æ¯ç±»åï¼1-ææ¬ï¼2-å¾çï¼3-è¯é³ï¼253    var datatype = dataList[i].msgType;  254    var sendState= dataList[i].sendStatus;255    var msgId=dataList[i].msgId;256    switch(parseInt(datatype)){257        case 1:258          switch(parseInt(sendState)){259            case 2:260              var str = '<div class="ub hhuinn-tb ">' + 261                         '<div class="uhide tm">' + msgId + '</div>' +262                          '<div class="ub-f200"></div>' +263                         '<div id="copyMessage'+ i +'" class="ub-f1 ub hhkuinn-r ub-pe">' +264                           '<div class="ub">' + 265                             '<div class="ub-f1 ub hhuinn hhc-green hhuc-a">'+266                               '<div id="'+ i +'" class="gz-ulev hhline-hei bc-text ub ub-ac umw2 hx copyMessage">' + dataList[i].content + '</div></div>' +267                             '<div class="hhjiantou huihuajiantour ub-img-l posileft"></div>' + '</div>' + '</div>' + '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';268            269            break;270            271            case 3:272             var str = '<div class="ub hhuinn-tb">' + 273                        '<div class="ub-f200"></div>' + 274                        '<div class=" iconwh1 huihuaunload ub-img"></div> ' +275                        '<div id="copyMessage'+ i +'" class="ub-f1 ub hhkuinn-r ub-pe">' +276                          '<div class="ub">' + 277                           '<div class="ub-f1 ub hhuinn hhc-green hhuc-a">'+278                             '<div id="'+ i +'" class="gz-ulev hhline-hei bc-text ub ub-ac umw2 hx copyMessage">' + dataList[i].content + '</div>'+279                           '</div>' +                             280                           '<div class="hhjiantou huihuajiantour ub-img-l posileft"></div>' +281                         '</div>' +282                       '</div>' + 283                      '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';       284            break;                285            }286        break;287        288        case 2:289          switch(parseInt(sendState)){290            case 2:291              var str = '<div class="ub hhuinn-tb">' + 292                          '<div class="uhide tm">' + msgId + '</div>' +293                           '<div class="ub-f200"></div>' + 294                           '<div class="ub-f1 ub hhkuinn-r ub-pe">' + 295                             '<div class="ub-f1 ub ub-pe">' + 296                               '<div class="ub piclist" id="tp_'+msgId+'" tpsrc="'+dataList[i].resPath+'">' +297                                   '<div class="ub-img1 ub-f1 hhuc-a hhuba hhumaxwh1" style="background-image:url('+dataList[i].resPath+') !important" >'+298                                   '</div>' + 299                                '</div>' + 300                             '</div>' + 301                           '<div class="hhjiantou huihuajiantour ub-img-l posileft2"></div>' + '</div>' + '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';302            break; 303            304            case 3:305              var str = '<div class="ub hhuinn-tb piclist">' +306                          '<div class="ub-f200"></div>' + 307                          '<div class=" iconwh1 huihuaunload ub-img"></div>' + 308                          '<div class="ub-f1 ub hhkuinn-r ub-pe">' +309                            '<div class="ub-f1 ub ub-pe">' + 310                               '<div class="ub piclist" id="tp_'+msgId+'" tpsrc="'+dataList[i].resPath+'">' + 311                                  '<div class="ub-img1 ub-f1 hhuc-a hhuba hhumaxwh1" style="background-image:url('+dataList[i].resPath+') !important" id="img1"></div>' + '</div>' + '</div>' + '<div class="hhjiantou huihuajiantour ub-img-l posileft2"></div>' + '</div>' + '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';312            break;   313              314              315          }316        break;317        318        case 3:        319          switch(parseInt(sendState)){320            case 2:321               var str = '<div class="ub hhuinn-tb">' +322                          '<div class="uhide tm">' + msgId + '</div>' +                         323                           '<div class="ub-f200"></div>' + 324                             '<div class="ub-f1 ub hhkuinn-r ub-pe">' +325                               '<div class=" ub-img"></div>' +326                                '<div class=" ub myshengyin audioPlay">' +327                                  '<div class="uhide dz" flag="0">' + dataList[i].resPath + '</div>' + 328                                '<div class="ub-f1 ub yuyinduihua hhuc-a  ub-pe hhc-green hhuinn voice" id="dddd' + i + '" >' + 329                                 '<div class="ub ub-ac">' + 330                                  '<div id="yuyinlen" class="bc-text-head ulev-1 uinn4">' + dataList[i].voiceTime + '</div>' +                               331                                   '</div> ' + 332                                   '<div class="yuyin3 ub-img"></div>' + 333                                    '<div class="ub ub-ac rwagzmbuinn-l1">' + 334                                    '<div class="yuyin2 ub-img"></div>' + '</div>' + '</div> ' + '<div class="hhjiantou huihuajiantour2 ub-img-l posileft"></div>' + '</div>' + '</div>' + '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';335            break; 336            337            case 3:338              var str = '<div class="ub hhuinn-tb ">' + 339                          '<div class="ub-f200"></div>' + 340                          '<div class=" iconwh1 huihuaunload ub-img"></div>' +341                           '<div class="ub-f1 ub hhkuinn-r ub-pe">' + 342                            '<div class="ub-img"></div>' +343                              '<div class=" ub myshengyin ">' +344                                '<div class="ub-f1 ub yuyinduihua hhuc-a  ub-pe hhc-green hhuinn voice" id="dddd' + i + '">' + 345                                 '<div class="ub ub-ac">' + 346                                  '<div id="yuyinlen" class="bc-text-head ulev-1 uinn4">' + dataList[i].voiceTime + '</div>' + '</div> ' + '<div class="yuyin3 ub-img"></div>' + '<div class="ub ub-ac rwagzmbuinn-l1">' + '<div class="yuyin2 ub-img"></div>' + '</div>' + '</div> ' + '<div class="hhjiantou huihuajiantour2 ub-img-l posileft"></div>' + '</div>' + '</div>' + '<div class="iconwh ub-img" style="background-image:url(' + selfImg1 + ') !important"></div>' + '</div>';347            break;   348                   }349        350        break;351           352    }353    354 return str;   355}356//åéæå页颿»å°æåºé¨357function toDown(){358  window.scrollTo(0, document.body.scrollHeight);359}360function replaceStr(str){ 361  var s=str.replace(/"|'/g,'â');  362  return s;363}364function getNameById(id){365    var userId_name=localStorage.getItem("simcere.im.userId_name");366    if(userId_name == null || userId_name==""){367        userId_name ={};368    }else{369       userId_name = JSON.parse(localStorage.getItem("simcere.im.userId_name"));370    }371    var url = SimcereConfig.server.emm+'/appIn/queryUser/'+id; 372    appcan.request.ajax({373    url : url,374    type : 'GET',375    offline : true,376    dataType : "text" ,377    success : function(data) {378        var data=JSON.parse(data);379        if(data.status=="ok"){380            userId_name[data.userId]={381                userName : data.userName382            } 383           var name = data.userName ; 384           localStorage.setItem("simcere.im.userId_name",JSON.stringify(userId_name));385           return name ; 386        }    387     }388    })    ...main.js
Source:main.js  
1jQuery(function ($) {2    // General stuff3    $(document).on("click", ".handlediv, h3.hndle", function(event){4        event.preventDefault();5        $(this).closest(".postbox").toggleClass("closed");6    });7    // Parent entry title8    function titleUrlSwitch () {9        if ( $(this).is(":checked") ){10            $(this).closest("td").find(".title_link-this_url").attr("disabled", false);11        } else{12            $(this).closest("td").find(".title_link-this_url").attr("disabled", true);13        }14    }15    titleUrlSwitch();16    $(document).on("change", '.title_link-this_url-switch', titleUrlSwitch);17    // handling parent menu link type18    $(document).on("change", "input[type='radio'].title_link-url-type", function(){19        var $url = $(this).closest("td").find(".title_link-this_url");20        $url.val($(this).data("value"));21        if( $(this).hasClass("title_link-this_url-switch") ){22            $url.removeAttr("disabled").attr("disabled", false);23        }else{24            $url.attr("disabled", true);25        }26    });27    // Sub menu preview28    function updateUrlPreview () {29        if( typeof $(this).attr("value") === "undefined"){30            return false;31        }32        var $parent = $(this).closest(".postbox"),33            type = $parent.find(".wdcab_last_wizard_step_url_type").val(),34            url = $parent.find(".wdcab_last_wizard_step_url").val();35        type = $parent.find("option[value='" + type +  "']").data("value");36        var preview = type + url;37        $parent.find(".wdcab_url_preview code").text(preview);38        return true;39    }40    updateUrlPreview();41    $(document).on("change", ".wdcab_last_wizard_step_url_type", updateUrlPreview);42    $(document).on("keyup", ".wdcab_last_wizard_step_url", updateUrlPreview);43    // Delete button44    $(document).on( "click", ".wdcab_step_delete", function (event) {45        event.preventDefault();46        var $parent = $(this).closest('.postbox');47        $parent.find(".inside").remove();48        $parent.toggle("highlight", function(){49          $(this).remove();50        });51    });52    // Adding a new admin bar53    $(document).on("click", "#ub_add_new_admin_bar", function(event){54        event.preventDefault();55       //var $main = $("#ub_main_admin_bar"),56       var $main = $("#ub_admin_bar_template");57           $new_bar = $($main.html());58           //console.log($main.html());return;59        $new_bar.find(".postbox").removeClass("closed");60       // remove content61       $new_bar.find(".hndle span").not(".ub_add_new_link_box").text(ub_admin_bar.new_bar);62       //$new_bar.find(".ub_add_new_link_box .hndle span").text(ub_admin_bar.save_before_adding);63       $new_bar.find(".ub_add_new_link_box .hndle span").text(ub_admin_bar.new_bar_sub_menu);64        /**65         * change name of inputs66         */67        var new_bars_count = parseInt( $(".parent_admin_bar_new").length, 10 );68        $new_bar.find("input, select").each(function(){69           var name = $(this).attr("name"),70               new_name = name.replace( "ub_ab_tmp[]", "ub_ab_new[" + new_bars_count + "]"),71               new_name = new_name.replace( "ub_ab_new[" + ( new_bars_count - 1) + "]", "ub_ab_new[" + new_bars_count + "]");72           $(this).attr("name", new_name);73        });74       $("#ub_admin_bar_menus").append($new_bar);75    });76    // Add deleted row to delete hidden input77    $(document).on("click", ".ub_delete_row", function(){78        var id = $(this).data("id"),79            $input = $("input[name='ub_ab_delete_links']"),80            ids = $input.val() !== "" ?  $input.val().split(",") : [];81        if( typeof id !== "undefined" && id !== ""  ){82            ids.push(id);83            $input.val( ids.join(", ") );84        }85    });86    // Sortable items87    $(".submenu-box-sortables").not(".not-sortable")88        .sortable({89            handle: ".hndle",90            axis: "y",91            update : function () {92                $(this).find(".postbox").each(function (index) {93                    $(this).find('.hndle .wdcab_step_count').html( index+1 );94                });95            }96        });97    // Make parent menus sortable98//    $("#ub_admin_bar_menus").sortable({99//        //appendTo: '#ub_admin_bar_menus',100//        //containment: "#ub_admin_bar_menus",101//        //forcePlaceholderSize: true,102//        axis: "y",103//        handle: ".hndle",104//        update : function () {105//            $(".parent_admin_bar").each(function (index) {106//                $(this).find('.ub_ad_main_order').html( index+1 );107//            });108//        }109//    });110    $(document).on("click", ".click_disabled, #wpadminbar a[href='#']", function(event){111            event.preventDefault();112    });113    var UB_Ordering = {114        children : function(hide){115            hide = typeof hide === "undefined" ? true : false;116            if( hide ){117                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default > li").css({118                    cursor : "move"119                }).find(".ab-sub-wrapper").css({120                    visibility : "hidden"121                });122            }else{123                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default > li").css({124                    cursor : "default"125                }).find(".ab-sub-wrapper").css({126                    visibility : "visible"127                });128            }129        },130        sortable : function( make ) {131            make = typeof make === "undefined" ? true : false;132            if( make ){133                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default a").addClass("click_disabled");134                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default").sortable({135                    axis: "x",136                    forceHelperSize: true,137                    forcePlaceholderSize: true,138                    distance : 2,139                    handle: "a",140                    tolerance: "intersect",141                    cursor: "move"142                }).sortable( "enable" );143            }else{144                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default a").removeClass("click_disabled");145                $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default").sortable( "disable" );146            }147        },148        wiggle : function(wiggle) {149            wiggle = typeof wiggle === "undefined" ? true : false;150            var $el = $("#ub_admin_bar_wrap ul#wp-admin-bar-root-default > li");151            if( wiggle ){152                $el.ClassyWiggle("start", {153                    degrees: ['2', '4', '2', '0', '-2', '-4', '-2', '0'],154                    delay : 90155                });156            }else{157                $el.ClassyWiggle("stop");158            }159        },160        add_save_button : function(){161            $("#ub_admin_bar_save_ordering").remove();162            $("#wp-admin-bar-root-default").after("<button id='ub_admin_bar_save_ordering'></button>");163        },164        start : function(){165            this.children();166            this.sortable();167            this.wiggle();168            this.add_save_button();169        },170        stop : function(){171            this.children( false );172            this.sortable( false );173            this.wiggle( false );174            $("#ub_admin_bar_save_ordering").slideUp(100, function(){175                $(this).remove();176            });177        },178        save : function(){179            var self = this,180                $button = $( "#ub_admin_bar_save_ordering" );181            $button.attr("disabled", true).addClass("ub_loading");182            order = [];183            $("#ub_admin_bar_wrap #wp-admin-bar-root-default > li").each(function(){184                if( typeof this.id === "string" &&  this.is !== "" ){185                    order.push( this.id.replace( "wp-admin-bar-", "" ) );186                }187            });188            $.ajax({189               url      : ajaxurl,190               type     : "post",191               data     : {192                   action   : "ub_save_menu_ordering",193                   order    : order194               },195               success  : function( data ){196                   if( data.status ){197                       self.stop();198                       $button.remove();199                   }else{200                       $button.attr("disabled", false).removeClass("ub_loading");201                   }202               }203            });204        }205    };206    $("#ub_admin_bar_start_ordering").on("click", function( e ){207        e.preventDefault();208        UB_Ordering.start();209    });210    $(document).on("click", "#ub_admin_bar_save_ordering", function( e ){211        e.preventDefault();212        UB_Ordering.save();213    });...oldVersions.js
Source:oldVersions.js  
1export const oldAttributes = {2	ub_call_to_action_headline_text: {3		type: 'array',4		source: 'children',5		selector: '.ub_call_to_action_headline_text'6	},7	ub_cta_content_text: {8		type: 'array',9		source: 'children',10		selector: '.ub_cta_content_text'11	},12	ub_cta_button_text: {13		type: 'array',14		source: 'children',15		selector: '.ub_cta_button_text'16	},17	headFontSize: {18		type: 'number',19		default: 3020	},21	headColor: {22		type: 'string',23		default: '#444444'24	},25	headAlign: {26		type: 'string',27		default: 'center'28	},29	contentFontSize: {30		type: 'number',31		default: 1532	},33	contentColor: {34		type: 'string',35		default: '#444444'36	},37	buttonFontSize: {38		type: 'number',39		default: 1440	},41	buttonColor: {42		type: 'string',43		default: '#E27330'44	},45	buttonTextColor: {46		type: 'string',47		default: '#ffffff'48	},49	buttonWidth: {50		type: 'number',51		default: 25052	},53	ctaBackgroundColor: {54		type: 'string',55		default: '#f8f8f8'56	},57	ctaBorderColor: {58		type: 'string',59		default: '#ECECEC'60	},61	ctaBorderSize: {62		type: 'number',63		default: 264	},65	url: {66		type: 'string',67		source: 'attribute',68		selector: 'a',69		attribute: 'href'70	},71	contentAlign: {72		type: 'string',73		default: 'center'74	},75	addNofollow: {76		type: 'boolean',77		default: false78	},79	openInNewTab: {80		type: 'boolean',81		default: false82	}83};84export const version_1_1_2 = props => {85	const {86		ctaBackgroundColor,87		ctaBorderSize,88		ctaBorderColor,89		headFontSize,90		headColor,91		ub_call_to_action_headline_text,92		contentFontSize,93		contentColor,94		contentAlign,95		ub_cta_content_text,96		buttonColor,97		buttonWidth,98		url,99		buttonTextColor,100		buttonFontSize,101		ub_cta_button_text102	} = props.attributes;103	return (104		<div className={props.className}>105			<div106				className="ub_call_to_action"107				style={{108					backgroundColor: ctaBackgroundColor,109					border: ctaBorderSize + 'px solid',110					borderColor: ctaBorderColor111				}}112			>113				<div className="ub_call_to_action_headline">114					<p115						className="ub_call_to_action_headline_text"116						style={{117							fontSize: headFontSize + 'px',118							color: headColor119						}}120					>121						{ub_call_to_action_headline_text}122					</p>123				</div>124				<div className="ub_call_to_action_content">125					<p126						className="ub_cta_content_text"127						style={{128							fontSize: contentFontSize + 'px',129							color: contentColor,130							textAlign: contentAlign131						}}132					>133						{ub_cta_content_text}134					</p>135				</div>136				<div className="ub_call_to_action_button">137					<span138						className={`wp-block-button ub_cta_button`}139						style={{140							backgroundColor: buttonColor,141							width: buttonWidth + 'px'142						}}143					>144						<a href={url} target="_blank">145							<p146								className="ub_cta_button_text"147								style={{148									color: buttonTextColor,149									fontSize: buttonFontSize + 'px'150								}}151							>152								{ub_cta_button_text}153							</p>154						</a>155					</span>156				</div>157			</div>158		</div>159	);160};161export const version_1_1_4 = props => {162	const {163		ctaBackgroundColor,164		ctaBorderSize,165		ctaBorderColor,166		headFontSize,167		headColor,168		ub_call_to_action_headline_text,169		contentFontSize,170		contentColor,171		contentAlign,172		ub_cta_content_text,173		buttonColor,174		buttonWidth,175		url,176		buttonTextColor,177		buttonFontSize,178		ub_cta_button_text179	} = props.attributes;180	return (181		<div className={props.className}>182			<div183				className="ub_call_to_action"184				style={{185					backgroundColor: ctaBackgroundColor,186					border: ctaBorderSize + 'px solid',187					borderColor: ctaBorderColor188				}}189			>190				<div className="ub_call_to_action_headline">191					<p192						className="ub_call_to_action_headline_text"193						style={{194							fontSize: headFontSize + 'px',195							color: headColor196						}}197					>198						{ub_call_to_action_headline_text}199					</p>200				</div>201				<div className="ub_call_to_action_content">202					<p203						className="ub_cta_content_text"204						style={{205							fontSize: contentFontSize + 'px',206							color: contentColor,207							textAlign: contentAlign208						}}209					>210						{ub_cta_content_text}211					</p>212				</div>213				<div className="ub_call_to_action_button">214					<span215						className={`wp-block-button ub_cta_button`}216						style={{217							backgroundColor: buttonColor,218							width: buttonWidth + 'px'219						}}220					>221						<a href={url} target="_blank" rel="noopener noreferrer">222							<p223								className="ub_cta_button_text"224								style={{225									color: buttonTextColor,226									fontSize: buttonFontSize + 'px'227								}}228							>229								{ub_cta_button_text}230							</p>231						</a>232					</span>233				</div>234			</div>235		</div>236	);237};238export const version_1_1_5 = props => {239	const {240		ctaBackgroundColor,241		ctaBorderSize,242		ctaBorderColor,243		headFontSize,244		headColor,245		headAlign,246		ub_call_to_action_headline_text,247		contentFontSize,248		contentColor,249		contentAlign,250		ub_cta_content_text,251		buttonColor,252		buttonWidth,253		url,254		buttonTextColor,255		buttonFontSize,256		ub_cta_button_text257	} = props.attributes;258	return (259		<div className={props.className}>260			<div261				className="ub_call_to_action"262				style={{263					backgroundColor: ctaBackgroundColor,264					border: ctaBorderSize + 'px solid',265					borderColor: ctaBorderColor266				}}267			>268				<div className="ub_call_to_action_headline">269					<p270						className="ub_call_to_action_headline_text"271						style={{272							fontSize: headFontSize + 'px',273							color: headColor,274							textAlign: headAlign275						}}276					>277						{ub_call_to_action_headline_text}278					</p>279				</div>280				<div className="ub_call_to_action_content">281					<p282						className="ub_cta_content_text"283						style={{284							fontSize: contentFontSize + 'px',285							color: contentColor,286							textAlign: contentAlign287						}}288					>289						{ub_cta_content_text}290					</p>291				</div>292				<div className="ub_call_to_action_button">293					<span294						className={`wp-block-button ub_cta_button`}295						style={{296							backgroundColor: buttonColor,297							width: buttonWidth + 'px'298						}}299					>300						<a href={url} target="_blank" rel="noopener noreferrer">301							<p302								className="ub_cta_button_text"303								style={{304									color: buttonTextColor,305									fontSize: buttonFontSize + 'px'306								}}307							>308								{ub_cta_button_text}309							</p>310						</a>311					</span>312				</div>313			</div>314		</div>315	);316};317export const version_2_0_0 = props => {318	const {319		ctaBackgroundColor,320		ctaBorderSize,321		ctaBorderColor,322		headFontSize,323		headColor,324		headAlign,325		ub_call_to_action_headline_text,326		contentFontSize,327		contentColor,328		contentAlign,329		ub_cta_content_text,330		buttonColor,331		buttonWidth,332		url,333		buttonTextColor,334		buttonFontSize,335		ub_cta_button_text,336		addNofollow,337		openInNewTab338	} = props.attributes;339	return (340		<div className={props.className}>341			<div342				className="ub_call_to_action"343				style={{344					backgroundColor: ctaBackgroundColor,345					border: ctaBorderSize + 'px solid',346					borderColor: ctaBorderColor347				}}348			>349				<div className="ub_call_to_action_headline">350					<p351						className="ub_call_to_action_headline_text"352						style={{353							fontSize: headFontSize + 'px',354							color: headColor,355							textAlign: headAlign356						}}357					>358						{ub_call_to_action_headline_text}359					</p>360				</div>361				<div className="ub_call_to_action_content">362					<p363						className="ub_cta_content_text"364						style={{365							fontSize: contentFontSize + 'px',366							color: contentColor,367							textAlign: contentAlign368						}}369					>370						{ub_cta_content_text}371					</p>372				</div>373				<div className="ub_call_to_action_button">374					<a375						href={url}376						target={openInNewTab ? '_blank' : '_self'}377						rel={`${378							addNofollow ? 'nofollow ' : ''379						}noopener noreferrer`}380						className={`wp-block-button ub_cta_button`}381						style={{382							backgroundColor: buttonColor,383							width: buttonWidth + 'px'384						}}385					>386						<p387							className="ub_cta_button_text"388							style={{389								color: buttonTextColor,390								fontSize: buttonFontSize + 'px'391							}}392						>393							{ub_cta_button_text}394						</p>395					</a>396				</div>397			</div>398		</div>399	);400};401export const updateFrom = oldVersion => {402	return { attributes: oldAttributes, save: oldVersion };...button.js
Source:button.js  
1import {2  emitter,3  listeners4} from '../mixins'5function getButton (weex) {6  return {7    name: 'Button',8    mixins: [emitter, listeners],9    props: {10      hoverClass: {11        type: String,12        default: 'button-hover'13      },14      disabled: {15        type: [Boolean, String],16        default: false17      },18      id: {19        type: String,20        default: ''21      },22      type: {23        type: String,24        default: 'default'25      },26      size: {27        type: String,28        default: 'default'29      },30      plain: {31        type: [Boolean, String],32        default: false33      },34      loading: {35        type: [Boolean, String],36        default: false37      },38      hoverStopPropagation: {39        type: Boolean,40        default: false41      },42      hoverStartTime: {43        type: [Number, String],44        default: 2045      },46      hoverStayTime: {47        type: [Number, String],48        default: 7049      },50      formType: {51        type: String,52        default: '',53        validator: function validator (value) {54          return ~['', 'submit', 'reset'].indexOf(value)55        }56      }57    },58    data: function data () {59      return {60        TYPES: {61          default: 'd',62          primary: 'p',63          warn: 'w'64        },65        clickFunction: null66      }67    },68    methods: {69      _onClick ($event, isLabelClick) {70        if (this.disabled) {71          return72        }73        if (isLabelClick) {74          this.$el.click()75        }76        if (this.formType) {77          this.$dispatch('Form', this.formType === 'submit' ? 'uni-form-submit' : 'uni-form-reset', {78            type: this.formType79          }, this)80        }81      },82      _getClass (t) {83        let cl = 'ub-' + this.TYPES[this.type] + t84        if (this.disabled) {85          cl += '-d'86        }87        if (this.plain) {88          cl += '-plain'89        }90        if (t === '-t' && this.size === 'mini') {91          cl += ' ub-mini'92        }93        return cl94      },95      _getHoverClass (t) {96        if (this.disabled) {97          return ''98        }99        let cl = 'ub-' + this.TYPES[this.type] + t + '-hover'100        if (this.plain) {101          cl += '-plain'102        }103        return cl104      }105    },106    render (createElement) {107      const _vm = this108      return createElement('view', _vm._g({109        staticClass: ['ub'],110        class: _vm._getClass(''),111        attrs: {112          'hoverClass': _vm._getHoverClass('')113        },114        on: {115          'click': _vm._onClick116        }117      }, _vm.$listeners), [(_vm.loading) ? createElement('loading-indicator', {118        staticClass: ['ub-loading'],119        class: ['ub-' + _vm.TYPES[_vm.type] + '-loading'],120        attrs: {121          'arrow': 'false',122          'animating': 'true'123        }124      }) : _vm._e(), createElement('u-text', {125        staticClass: ['ub-t'],126        class: _vm._getClass('-t')127      }, [_vm._t('default')], 2)], 1)128    },129    style: {130      'ub': {131        'flexDirection': 'row',132        'alignItems': 'center',133        'justifyContent': 'center',134        'position': 'relative',135        'paddingLeft': '5',136        'paddingRight': '5',137        'overflow': 'hidden',138        'color': '#000000',139        'backgroundColor': '#f8f8f8',140        'borderRadius': '5',141        'borderStyle': 'solid',142        'borderWidth': '1',143        'borderColor': '#dbdbdb'144      },145      'ub-t': {146        'color': '#000000',147        'fontSize': '18',148        'textDecoration': 'none',149        'lineHeight': '46'150      },151      'ub-d': {152        'backgroundColor': '#f8f8f8'153      },154      'ub-p': {155        'backgroundColor': '#007aff',156        'borderColor': '#0062cc'157      },158      'ub-w': {159        'backgroundColor': '#e64340',160        'borderColor': '#b83633'161      },162      'ub-d-t': {163        'color': '#000000'164      },165      'ub-p-t': {166        'color': '#ffffff'167      },168      'ub-w-t': {169        'color': '#ffffff'170      },171      'ub-d-d': {172        'backgroundColor': '#f7f7f7'173      },174      'ub-p-d': {175        'backgroundColor': '#63acfc',176        'borderColor': '#4f8aca'177      },178      'ub-w-d': {179        'backgroundColor': '#ec8b89',180        'borderColor': '#bd6f6e'181      },182      'ub-d-t-d': {183        'color': '#cccccc'184      },185      'ub-p-t-d': {186        'color': 'rgba(255,255,255,0.6)'187      },188      'ub-w-t-d': {189        'color': 'rgba(255,255,255,0.6)'190      },191      'ub-d-plain': {192        'borderColor': '#353535',193        'backgroundColor': 'rgba(0,0,0,0)'194      },195      'ub-p-plain': {196        'borderColor': '#007aff',197        'backgroundColor': 'rgba(0,0,0,0)'198      },199      'ub-w-plain': {200        'borderColor': '#e64340',201        'backgroundColor': 'rgba(0,0,0,0)'202      },203      'ub-d-t-plain': {204        'color': '#353535'205      },206      'ub-p-t-plain': {207        'color': '#007aff'208      },209      'ub-w-t-plain': {210        'color': '#e64340'211      },212      'ub-d-d-plain': {213        'borderColor': '#c6c6c6',214        'backgroundColor': 'rgba(0,0,0,0)'215      },216      'ub-p-d-plain': {217        'borderColor': '#c6c6c6',218        'backgroundColor': 'rgba(0,0,0,0)'219      },220      'ub-w-d-plain': {221        'borderColor': '#c6c6c6',222        'backgroundColor': 'rgba(0,0,0,0)'223      },224      'ub-d-t-d-plain': {225        'color': 'rgba(0,0,0,0.2)'226      },227      'ub-p-t-d-plain': {228        'color': 'rgba(0,0,0,0.2)'229      },230      'ub-w-t-d-plain': {231        'color': 'rgba(0,0,0,0.2)'232      },233      'ub-mini': {234        'lineHeight': '30',235        'fontSize': '13',236        'paddingTop': 0,237        'paddingRight': '17.5',238        'paddingBottom': 0,239        'paddingLeft': '17.5'240      },241      'ub-loading': {242        'width': '18',243        'height': '18',244        'marginRight': '10'245      },246      'ub-d-loading': {247        'color': 'rgba(255,255,255,0.6)',248        'backgroundColor': 'rgba(0,0,0,0)'249      },250      'ub-p-loading': {251        'color': 'rgba(255,255,255,0.6)',252        'backgroundColor': 'rgba(0,0,0,0)'253      },254      'ub-w-loading': {255        'color': 'rgba(255,255,255,0.6)',256        'backgroundColor': '#ce3c39'257      },258      'ub-d-loading-plain': {259        'color': '#353535'260      },261      'ub-p-loading-plain': {262        'color': '#007aff',263        'backgroundColor': '#0062cc'264      },265      'ub-w-loading-plain': {266        'color': '#e64340',267        'backgroundColor': 'rgba(0,0,0,0)'268      },269      'ub-d-hover': {270        'opacity': 0.8,271        'backgroundColor': '#dedede'272      },273      'ub-p-hover': {274        'opacity': 0.8,275        'backgroundColor': '#0062cc'276      },277      'ub-w-hover': {278        'opacity': 0.8,279        'backgroundColor': '#ce3c39'280      },281      'ub-d-t-hover': {282        'color': 'rgba(0,0,0,0.6)'283      },284      'ub-p-t-hover': {285        'color': 'rgba(255,255,255,0.6)'286      },287      'ub-w-t-hover': {288        'color': 'rgba(255,255,255,0.6)'289      },290      'ub-d-hover-plain': {291        'color': 'rgba(53,53,53,0.6)',292        'borderColor': 'rgba(53,53,53,0.6)',293        'backgroundColor': 'rgba(0,0,0,0)'294      },295      'ub-p-hover-plain': {296        'color': 'rgba(26,173,25,0.6)',297        'borderColor': 'rgba(0,122,255,0.6)',298        'backgroundColor': 'rgba(0,0,0,0)'299      },300      'ub-w-hover-plain': {301        'color': 'rgba(230,67,64,0.6)',302        'borderColor': 'rgba(230,67,64,0.6)',303        'backgroundColor': 'rgba(0,0,0,0)'304      }305    }306  }307}308export default function init (Vue, weex) {309  Vue.component('button', getButton(weex))...ublue_ImageCarousel.js
Source:ublue_ImageCarousel.js  
1(function($){2	/*!3	* Ublue jQuery Image Carousel4	* Copyright (c) 2013, 梦幻ç¥å5	* Create: 2013.08.086	* Version: 2.07	* Update: 1.æ°å¢ä¸ä¸æ»å¨å缩ç¥å¾æ¨¡å¼ 2.é¨åè¯å¥éæ°å®ä¹ 3.é»è¾ä¼å 4.æ´ä¸ºç²¾ç®8	* Version: 2.1 ï¼2013-10-21ï¼9	* Update: 1.æ°å¢å·¦å³æ ç¼æ»å¨ 2.è¯å¥ä¼å10	* Version: 2.2 ï¼2013-11-18ï¼11	* Update: 1.æ°å¢ä¸ä¸æ ç¼æ»å¨ 2.代ç ä¼å12	*13	* 请ä¿çæ¤ä¿¡æ¯ï¼å¦ææ¨æä¿®æ¹ææè§å¯éè¿ç½ç«ç»æçè¨14	* http://www.bluesdream.com15	*/16	$.fn.ublue_ImageCarousel=function(opts){17		var $this = $(this);18		// options19		opts = $.extend({20			// Domèç¹21			ubArea:'.focusArea',				// å¤å±ï¼ä¸ä¸æ ç¼æ»å¨æ¶ï¼ä»¥è¯¥å±åå®ä½ï¼22			ubCon:'.focusCon',					// å
å®¹ï¼æ»å¨æ¶ä»¥è¯¥å±åå®ä½ï¼23			ubItem:'.focusItem',				// å表项24			ubIndicators:'.focusIndicators',		// å°æé®25			ubPrev:'.focusPrev',					// å䏿é®26			ubNext:'.focusNext',				// å䏿é®27			// ææå±ç° ï¼ä»¥ä¸ä¸ºé»è®¤å¼ï¼28			ubEffect:'left',						// ææåç°æ¹å¼ 'left' 'top' 'fade' 'leftSeamless' 'topSeamless'29			ubTrigger:'hover',					// å°æé®ç»è§¦åæ¡ä»¶ 'hover' 'click'30			ubAutoPlay:'on',					// æ¯å¦èªå¨ææ¾31			ubAutoBtn:'on',						// 尿鮿¯å¦èªå¨çæï¼ä¾¿äºåæç¼©ç¥å¾å½¢å¼ï¼32			ubTitleHover:'off',					// æ é¢æ¯å¦æ»å¨æ¾ç¤º33			ubGallery:'off',						// æ¯å¦å¼å¯å¤å¾æ»å¨34			// æ¶é´è®¾ç½® ï¼ææ¯«ç§è®¡ç®ï¼1000毫ç§=1ç§ï¼35			ubTime:5000,						// èªå¨ææ¾çæ¶é´é´é36			ubSpeed:480,						// å¾ç忢çé度37			ubTitleSpeed:50					// æ é¢æ»è¿æ¾ç¤ºçé度38		}, opts);39		var $ubDistance,40			$ubJudge,41			$ubMax,42			$ubItemSize,43			$stpe			= 0,44			$animate		= {},$direction,45			$ubCon		= $this.find(opts.ubCon),46			$ubItem		= $this.find(opts.ubItem),47			$ubIndicators	= $this.find(opts.ubIndicators),48			$ubCount		= $ubItem.length,49			$ubItemW		= $ubItem.outerWidth(true),50			$ubItemH		= $ubItem.outerHeight(true),51			$ubMaxW		= Math.floor( $ubCon.width()/$ubItem.width() ),52			$ubMaxH		= Math.floor( $(this).find(opts.ubArea).height()/$ubItem.height() );53		// Initialization54		if( opts.ubEffect == 'fade' ){55			$ubMax = $ubMaxW;56			$ubItem.eq(0).show();57		}58		if( opts.ubEffect == 'left' || opts.ubEffect == 'leftSeamless' ){59			$ubItemSize = $ubItemW;60			$ubMax = $ubMaxW;61			$direction = 'left';62		}63		if( opts.ubEffect == 'top' || opts.ubEffect == 'topSeamless'){64			$ubItemSize = $ubItemH;65			$ubMax = $ubMaxH;66			$direction = 'top';67		}68		if ( opts.ubEffect == 'left' ) {69			$ubCon.css( 'width',$ubItemSize*$ubCount );70		}71		if ( opts.ubEffect == 'leftSeamless' ) {72			$ubCon.css( 'width',$ubItemSize*($ubMax+$ubCount) );73		}74		$ubDistance = opts.ubGallery=='off'?1:$ubMax;75		$ubJudge = opts.ubGallery=='off'?$ubCount-$ubMax:$ubCount/$ubMax-1;76		// Seamless77		if ( opts.ubEffect == 'leftSeamless' || opts.ubEffect == 'topSeamless' ) {78			var group = '<ul class=\'focusGroup\'></ul>';79			$ubCon.wrapInner(group).append(group);80			$ubCon.find('.focusGroup').last().append( $ubItem.slice(0, $ubMax).clone() );81			$ubJudge	= opts.ubGallery=='off'?$ubCount:Math.floor($ubCount/$ubMax);82		}83		// Indicators84		if ( opts.ubAutoBtn == 'on') {85			if ( opts.ubEffect == 'leftSeamless' || opts.ubEffect == 'topSeamless' ) {86				for ( var i =0; i < $ubJudge; i++ ) {87					$ubIndicators.append('<a>' + (i + 1) + '</a>');88				}89			}else{90				for ( var i =0; i <= $ubJudge; i++ ) {91					$ubIndicators.append('<a>' + (i + 1) + '</a>');92				}93			}94		}95		var $ubIndicatorsBtn = $ubIndicators.find('a');96		$ubIndicatorsBtn.eq(0).addClass('current');97		// AutoPlay98		if ( opts.ubAutoPlay == 'on') {99			var $autoScroll = setInterval(nextSwitch, opts.ubTime);100			$this.hover(function() {101				clearInterval($autoScroll);102			}, function() {103				$autoScroll = setInterval(nextSwitch, opts.ubTime);104			});105		}106		// Title Hide/Show107		if ( opts.ubTitleHover == 'on') {108			var $hideSpacing = parseInt( $ubItem.find('.title').css('bottom'));109			var $showSpacing = $hideSpacing + $ubItem.find('.title').outerHeight(true);110			$ubItem.hover(function(){111				var _this = $(this);112				titleDelay = setTimeout(function() {113					_this.find('.title').stop(true,false).animate({'bottom':Math.abs( $showSpacing )},opts.ubTitleSpeed);114				}, 150);115			},function(){116				$(this).find('.title').stop(true,false).animate({'bottom':$hideSpacing},opts.ubTitleSpeed);117				clearTimeout(titleDelay);118			});119		}120		// Switch121		function effectSwitch(op){122			switch(opts.ubEffect){123				case 'fade':124					$ubItem.eq(op).fadeIn(opts.ubSpeed).siblings().fadeOut(opts.ubSpeed);125					break;126				default:127					$animate[$direction] = -op*$ubDistance*$ubItemSize;128					$ubCon.animate($animate,opts.ubSpeed);129			}130			indicatorsStyle($stpe);131		}132		function nextSwitch(){133			if ( !$ubCon.is(':animated') && !$ubItem.is(':animated') ) {134				if ( opts.ubEffect == 'leftSeamless' || opts.ubEffect == 'topSeamless' ){135					if ( $stpe == $ubJudge-1 ) {136						$stpe++;137						$animate[$direction] = -$stpe*$ubDistance*$ubItemSize;138						$ubCon.animate($animate,opts.ubSpeed);139						indicatorsStyle(0);140					}else if( $stpe == $ubJudge ){141						$stpe = 1;142						$ubCon.css($direction,'0');143						effectSwitch($stpe);144					}else{145						$stpe++;146						effectSwitch($stpe);147					}148				}else{149					if ( $stpe == $ubJudge ) {150						$stpe = 0;151						effectSwitch($stpe);152					}else{153						$stpe++;154						effectSwitch($stpe);155					}156				}157			}158		}159		function prevSwitch(){160			if ( !$ubCon.is(':animated') && !$ubItem.is(':animated') ) {161				if ( $stpe == '0' ) {162					if ( opts.ubEffect == 'leftSeamless' || opts.ubEffect == 'topSeamless' ){163						$ubCon.css( $direction,-$ubJudge*$ubDistance*$ubItemSize );164						$stpe = $ubJudge-1;165					}else{166						$stpe = $ubJudge;167					}168				}else{169					$stpe--;170				}171				effectSwitch($stpe);172			}173		}174		function indicatorsStyle(op){175			$ubIndicatorsBtn.eq(op).addClass('current').siblings().removeClass('current');176		}177		// Trigger178		$this.find(opts.ubPrev).click(prevSwitch);179		$this.find(opts.ubNext).click(nextSwitch);180		if ( opts.ubTrigger == 'hover' ) {181			$ubIndicatorsBtn.hover(function(e) {182				var i = $(this).index();183				triggerDelay = setTimeout(function() {184					$stpe = i;185					effectSwitch($stpe);186				}, 200);187			},function(){188				clearTimeout(triggerDelay);189			});190		}else{191			$ubIndicatorsBtn.click(function() {192				$stpe = $(this).index();193				effectSwitch($stpe);194			});195		}196	};...989.js
Source:989.js  
1Ext.define(E.f.layout.va.al, {2  extend: C.f.pd,3  name: "inline-edit-widget",4  componentCls: "inline-edit-widget",5  Ub: m,6  Vp: m,7  tpl: m,8  multiline: !1,9  emptyText: "",10  text: "",11  Dp: !1,12  vAa: "",13  ae: 200,14  maxLength: 255,15  Pi: 0,16  rows: 1,17  eN: !1,18  data: {},19  Ce: !1,20  Ei: m,21  El: m,22  wi: m,23  si: m,24  NZ: !1,25  constructor: function (c) {26    c = c || {};27    this.st = c.st || m;28    this.callParent(arguments);29  },30  ka: {31    "a.sr-anchor": function (c, f) {32      c.stopEvent();33      C.k().sg(f.href, this);34    },35    ".inline-edit-text": function () {36      this.Ce || (this.Mj(), this.El.call(this.wi || this));37    }38  },39  initComponent: function () {40    var c = this.Dp ? C.ca.xa.wd(this.text, m, [C.ca.xa.ce, C.ca.xa.bg], [eht, nl2br]) : nl2br(eha(this.text));41    this.tpl = C.k().da.Wa("inline-edit-widget", {42      text: c != "" ? c : this.emptyText43    });44    this.on("afterrender", this.na, this);45  },46  destroy: function () {47    this.el.un("click", this.Nr, this);48    this.Ub && (this.si && this.Ub.un("blur", this.Cj, this), this.Ei && this.Ub.el.un("keydown", this.L_, this), this.Ub.el.un("keyup", this.P_, this), this.Ub.el.un("keydown", this.O_, this), this.Ub.el.un("keypress", this.Or, this));49    this.callParent();50  },51  nka: function () {52    if (this.Ub) {53      this.Ub.removeCls("d-none");54    } else {55      this.multiline ? (this.s2(!0), this.setText(this.text)) : this.s2();56      this.Ub.el.on("keypress", this.Or, this);57      if (this.Ei) {58        this.Ub.el.on("keydown", this.L_, this);59      }60      this.Ub.el.on("keyup", this.P_, this);61      this.Ub.el.on("keydown", this.O_, this);62    }63    this.addCls("edit");64    if (this.multiline && !this.Ce) {65      var c = this.Ub.getValue();66      this.Lt(c + " ");67      this.Lt(c);68    } else {69      this.Lt(m);70    }71    this.Ub.focus();72    !this.Ce && this.Ub && this.Xsa();73    this.Ce = !0;74    if (this.si && !this.NZ) {75      this.Ub.on("blur", this.Cj, this), this.NZ = !0;76    }77  },78  s2: function (c) {79    var f = {80      maxLength: this.maxLength,81      width: this.ae82    };83    if (c) {84      f.multiline = !0;85    }86    if (this.Pi) {87      f.Pi = this.Pi;88    }89    if (this.rows) {90      f.rows = this.rows;91    }92    this.Ub = Ext.create(E.f.layout.va.lE, f);93    this.Ub.render(this.el);94  },95  Lt: function (c) {96    if (typeof c === "undefined" || c === m) {97      c = this.text;98    }99    this.Ub.Rf(c);100  },101  getText: function () {102    return Ext.String.trim(this.text);103  },104  yy: function () {105    return Ext.String.trim(this.Ub.getValue());106  },107  setText: function (c) {108    if (typeof c !== "undefined" && c !== m) {109      this.text = typeof c !== "undefined" ? c : this.text;110      if (this.text.length) {111        this.text = this.text.substring(0, this.maxLength);112      }113      c = Ext.String.trim(this.text) != "" ? this.text : this.emptyText;114      this.Vp.dom.innerHTML = this.Dp ? C.ca.xa.wd(c, m, [C.ca.xa.ce, C.ca.xa.bg], [eht, nl2br]) : nl2br(eha(c));115      this.GN();116      this.Ub && this.Lt(m);117    }118  },119  na: function () {120    this.el.on("click", this.Nr, this);121    this.Vp = this.el.select(".inline-edit-text").first();122    this.GN();123  },124  Nr: function (c, h) {125    for (var f in this.ka) {126      if (c.getTarget(f)) {127        this.ka[f].call(this, c, h);128        break;129      }130    }131  },132  Cj: function () {133    this.Ce && this.si.call(this.wi || this);134  },135  oh: function () {136    if (this.Ub) {137      var c = this.Ub.getValue();138      if (c != this.text) {139        this.text = c;140      }141    }142    this.setText(this.text);143    this.close();144  },145  GN: function () {146    Ext.String.trim(this.text) ? this.Vp.removeCls("empty") : this.Vp.addCls("empty");147  },148  Xsa: function () {149    this.st && this.st.C3() == "edit" ? this.Ub.H7(this.getText().length, this.getText().length) : this.Ub.H7();150  },151  Mj: function () {152    this.Vp.addCls("d-none");153    this.nka();154  },155  close: function () {156    this.Ce = !1;157    this.Ub && (this.Ub.addCls("d-none"), this.Lt(m));158    this.GN();159    this.removeCls("edit");160    this.Vp.removeCls("d-none");161  },162  qCa: x("Ce"),163  Or: function (c) {164    c.getKey() != 8 && c.getKey() != 46 && this.Ub.getValue().length >= this.maxLength && c.stopEvent();165  },166  L_: function (c) {167    if (c.getKey() == 13 && !this.eN) {168      return c.stopEvent(), this.Ei.call(this.wi || this), !1;169    }170  },171  P_: function (c) {172    if (c.getKey() == 16) {173      this.eN = !1;174    }175  },176  O_: function (c) {177    if (c.getKey() == 16) {178      this.eN = !0;179    }180  }...cookie-notice-front.js
Source:cookie-notice-front.js  
1( function ( $ ) {2    /**3     * bind4     */5    $( document ).ready( function () {6        var value;7        $( ub_cookie_notice.id + ' .ub-cn-set-cookie' ).on( 'click', function ( e ) {8            e.preventDefault();9            $( this ).setUBCookieNotice();10        } );11        /**12         * it ws already shown13         */14        value = $.fn.BrandaGetCookieValue( ub_cookie_notice.cookie.name + '_close' );15        if ( 'hide' === value ) {16            $( ub_cookie_notice.id ).hide();17        }18    } );1920    /**21     * get cookie value22     */23    $.fn.BrandaGetCookieValue = function( cname ) {24        var name = cname + "=";25        var decodedCookie = decodeURIComponent(document.cookie);26        var ca = decodedCookie.split(';');27        for(var i = 0; i <ca.length; i++) {28            var c = ca[i];29            while (c.charAt(0) == ' ') {30                c = c.substring(1);31            }32            if (c.indexOf(name) == 0) {33                return c.substring(name.length, c.length);34            }35        }36        return "";37    }3839    /**40     * set Cookie Notice41     */42    $.fn.setUBCookieNotice = function () {43        var notice = $( ub_cookie_notice.id );44        var expires = new Date();45        var value = parseInt( expires.getTime() );46        var cookie = '';47        /**48         * set time49         */50        value = parseInt( expires.getTime() );51        /**52         * add time53         */54        value += parseInt( ub_cookie_notice.cookie.value ) * 1000;55        /**56         * add time zone57         */58        value += parseInt( ub_cookie_notice.cookie.timezone ) * 1000;59        /**60         * set time61         */62        expires.setTime( value );63        /**64         * add cookie timestamp65         */66        cookie = ub_cookie_notice.cookie.name + '=' + value/1000 + ';';67        cookie += ' expires=' + expires.toUTCString() + ';';68        if ( ub_cookie_notice.cookie.domain ) {69            cookie += ' domain=' + ub_cookie_notice.cookie.domain + ';';70        }71        /**72         * Add cookie now (fix cache issue)73         */74        cookie += ' path=' + ub_cookie_notice.cookie.path + ';';75        if ( 'on' === ub_cookie_notice.cookie.secure ) {76            cookie += ' secure;'77        }78        document.cookie = cookie;79        cookie = ub_cookie_notice.cookie.name + '_close=hide;';80        cookie += ' expires=;';81        if ( ub_cookie_notice.cookie.domain ) {82            cookie += ' domain=' + ub_cookie_notice.cookie.domain + ';';83        }84        cookie += ' path=' + ub_cookie_notice.cookie.path + ';';85        if ( 'on' === ub_cookie_notice.cookie.secure ) {86            cookie += ' secure;'87        }88        document.cookie = cookie;89        /**90         * set user meta91         */92        if ( undefined !== ub_cookie_notice.logged && 'yes' === ub_cookie_notice.logged ) {93            var data = {94                'action': 'ub_cookie_notice',95                'user_id': ub_cookie_notice.user_id,96                'nonce': ub_cookie_notice.nonce97            };98            $.post( ub_cookie_notice.ajaxurl, data );99        } else {100            // Dimiss the notice for visitor.101            var data = {102                'action': 'ub_dismiss_visitor_notice',103                'nonce': ub_cookie_notice.nonce104            };105            $.post( ub_cookie_notice.ajaxurl, data );106        }107        /**108         * reload109         */110        if ( undefined !== ub_cookie_notice.reloading && 'on' === ub_cookie_notice.reloading ) {111            document.location.reload( true );112            return;113        }114        /**115         * hide116         */117        var animation = undefined !== ub_cookie_notice.animation? ub_cookie_notice.animation:'none';118        switch( animation ) {119            case 'fade':120                notice.fadeOut( 400 );121                break;122            case 'slide':123                notice.slideUp( 400 );124                break;125            default:126                notice.hide();127        }128    };129
...UserSettings.js
Source:UserSettings.js  
1/*2 * Copyright (c) 2001-2011, TIBCO Software Inc.3 * Use, modification, and distribution subject to terms of license.4 */5jsx3.Class.defineClass("jsx3.app.UserSettings",null,null,function(o,g){var6ub={A:"<m/>",B:"undefined",C:"string",D:"number",E:"boolean",F:"0",G:"function",H:"usrset.persist",a:"object",b:"user-settings",c:"domain",d:"path",e:/\*/g,f:"%2A",g:/\+/g,h:"%2B",i:/</g,j:"*",k:/>/g,l:"+",m:"usrset.large",n:"NAMESPACE",o:"_ses",p:"_ind",q:"<",r:">",s:"s",t:"n",u:"m",v:"a",w:"b",x:"1",y:"u",z:"usrset.deser"};var7C=jsx3.xml.Entity;var8A=jsx3.util.Logger.getLogger(o.jsxclass.getName());o.PERSIST_SESSION=1;o.PERSIST_INDEFINITE=2;g.o0=null;g.dU=null;g.zH=null;g.init=function(e,n){if(n==null)n=2;this.o0=e;this.dU=n;var9wb=this.CI();this.zH=o.uw(wb);};g.get=function(i){var10Fa=this.zH;for(var11wa=0;wa<arguments.length;wa++){if(typeof Fa!=ub.a||jsx3.$A.is(Fa))return null;Fa=Fa[arguments[wa]];}return Fa;};g.set=function(a,k){var12ob=this.zH;for(var13Mb=0;Mb<arguments.length-2;Mb++){var14aa=ob[arguments[Mb]];if(typeof aa!=ub.a||jsx3.$A.is(aa))aa=ob[arguments[Mb]]=null;if(aa==null)aa=ob[arguments[Mb]]={};ob=aa;}ob[arguments[arguments.length-2]]=arguments[arguments.length-1];return ob;};g.remove=function(m){var15fa=this.zH;for(var16ab=0;ab<arguments.length-1;ab++){var17Za=fa[arguments[ab]];if(Za==null||typeof Za!=ub.a||jsx3.$A.is(Za))return;fa=Za;}delete fa[arguments[arguments.length-1]];};g.clear=function(){this.zH={};var18fb=this.KX();var19pa=this.o0.getSettings();var20ga=pa.get(ub.b,ub.c);var21ka=pa.get(ub.b,ub.d);this.o0.deleteCookie(fb,ka,ga);};g.save=function(){var22S=o.tD(this.zH);S=S.replace(ub.e,ub.f);S=S.replace(ub.g,ub.h);S=S.replace(ub.i,ub.j);S=S.replace(ub.k,ub.l);S=escape(S);var23Ha=S.length;if(Ha>4096)A.warn(jsx3._msg(ub.m,Ha));this.Rw(S);};g.KX=function(){return this.o0.getEnv(ub.n)+(this.dU==1?ub.o:ub.p);};g.CI=function(){var24xb=this.KX();var25ha=this.o0.getCookie(xb,true);if(ha){ha=ha.replace(ub.e,ub.q);ha=ha.replace(ub.g,ub.r);ha=unescape(ha);}return ha;};g.Rw=function(e){var26Qa=this.KX();var27qb=this.o0.getSettings();var28gb=qb.get(ub.b,ub.c);var29za=qb.get(ub.b,ub.d);var30Aa=new31Date();var32ab=this.dU==1?null:new33Date(Aa.getFullYear()+1,Aa.getMonth(),Aa.getDate());this.o0.setCookie(Qa,e,ab,za,gb,null,true);};o.uw=function(r){if(!r)return {};var34Xa=new35jsx3.xml.Document();Xa.loadXML(r);return o.UV(Xa.getRootNode());};o.UV=function(j){var36Cb=j.getNodeName();if(Cb==ub.s){return j.getValue();}else if(Cb==ub.t){return Number(j.getValue());}else if(Cb==ub.u){return (j.getChildNodes()).map(function(i){return [i.getAttribute(ub.t),o.UV(i)];},false,true);}else if(Cb==ub.v){return ((j.getChildNodes()).map(function(m){return o.UV(m);})).toArray(true);}else if(Cb==ub.w){return j.getValue()==ub.x;}else if(Cb==ub.y){return null;}else{A.warn(jsx3._msg(ub.z,Cb));return null;}};o.tD=function(f){var37Ta=new38jsx3.xml.Document();Ta.loadXML(ub.A);var39cb=Ta.getRootNode();for(var oa in f)o.tB(f[oa],oa,cb);return cb.getXML();};o.tB=function(p,l,q){var40Ga=null;var41Nb=typeof p;if(p==null||Nb==ub.B){Ga=q.createNode(1,ub.y);}else if(Nb==ub.C){Ga=q.createNode(1,ub.s);Ga.setValue(p);}else if(Nb==ub.D){Ga=q.createNode(1,ub.t);Ga.setValue(p);}else if(Nb==ub.E){Ga=q.createNode(1,ub.w);Ga.setValue(p?ub.x:ub.F);}else if(Nb==ub.a){if(jsx3.$A.is(p)){Ga=q.createNode(1,ub.v);for(var42fb=0;fb<p.length;fb++)o.tB(p[fb],fb.toString(),Ga);}else{Ga=q.createNode(1,ub.u);for(var kb in p)o.tB(p[kb],kb,Ga);}}else if(Nb==ub.G){}else throw new...Using AI Code Generation
1var myProtractor = require('protractor');2var myUb = require('ub');3var myProtractor = require('protractor');4var myUb = require('ub');5var myProtractor = myUb.protractor;6var myUb = require('ub');7var myProtractor = myUb.protractor;8var myUb = myProtractor.ub;9var myUb = require('ub');10var myProtractor = myUb.protractor;11var myUb = myProtractor.ub;12var myProtractor = myUb.protractor;13var myUb = require('ub');14var myProtractor = myUb.protractor;15var myUb = myProtractor.ub;16var myProtractor = myUb.protractor;17var myUb = myProtractor.ub;18var myProtractor = myUb.protractor;19var myUb = require('ub');20var myProtractor = myUb.protractor;21var myUb = myProtractor.ub;22var myProtractor = myUb.protractor;23var myUb = myProtractor.ub;24var myProtractor = myUb.protractor;25var myUb = myProtractor.ub;26var myProtractor = myUb.protractor;27var myUb = require('ub');28var myProtractor = myUb.protractor;29var myUb = myProtractor.ub;30var myProtractor = myUb.protractor;31var myUb = myProtractor.ub;32var myProtractor = myUb.protractor;33var myUb = myProtractor.ub;34var myProtractor = myUb.protractor;35var myUb = myProtractor.ub;36var myProtractor = myUb.protractor;37var myUb = myProtractor.ub;38var myProtractor = myUb.protractor;39var myUb = require('ub');40var myProtractor = myUb.protractor;41var myUb = myProtractor.ub;42var myProtractor = myUb.protractor;43var myUb = myProtractor.ub;Using AI Code Generation
1var mytest = require('ub.protractor');2var mytest = require('ub.protractor');3var mytest = require('ub.protractor');4var mytest = require('ub.protractor');5var mytest = require('ub.protractor');6var mytest = require('ub.protractor');7var mytest = require('ub.protractor');8var mytest = require('ub.protractor');9var mytest = require('ub.protractor');10var mytest = require('ub.protractor');11var mytest = require('ub.protractor');12var mytest = require('ub.protractor');13var mytest = require('ub.protractor');14var mytest = require('ub.protractor');Using AI Code Generation
1var Ub = require('ub');2var ub = new Ub();3describe('Ub Test', function() {4  it('should open the site', function() {5  });6  it('should click on the link', function() {7    ub.click('a[href="/about"]', 'About');8  });9});10### open(url)11#### url (required)12### click(locator, locatorName)13#### locator (required)14#### locatorName (required)15### clickAndWait(locator, locatorName)16#### locator (required)17#### locatorName (required)18### clickAndLoad(locator, locatorName, callback)19#### locator (required)20#### locatorName (required)21#### callback (required)22### clickAndLoad(locator, locatorName, callback)23#### locator (required)24#### locatorName (required)25#### callback (required)26### clickAndLoad(locator, locatorName, callback)27#### locator (required)28#### locatorName (required)29#### callback (required)30### clickAndLoad(locator, locatorName, callback)31#### locator (required)32#### locatorName (required)Protractor is developed by Google Developers to test Angular and AngularJS code. Today, it is used to test non-Angular applications as well. It performs a real-world user-like test against your application in a real browser. It comes under an end-to-end testing framework. As of now, Selenium Protractor has proved to be a popular framework for end-to-end automation for AngularJS.
Let’s talk about what it does:
 Protractor is a JavaScript framework, end-to-end test automation framework for Angular and AngularJS applications.
Protractor Selenium provides new locator methods that actually make it easier to find elements in the DOM.
Two files are required to execute Protractor Selenium tests for end-to-end automation: Specs & Config. Go through the link above to understand in a better way.
To carry out extensive, automated cross browser testing, you can't imagine installing thousands of the available browsers on your own workstation. The only way to increase browser usage is through remote execution on the cloud. To execute your automation test scripts across a variety of platforms and browser versions, LambdaTest offers more than 3000 browsers.
We recommend Selenium for end-to-end automation for AngularJS because both are maintained and owned by Google, and they build JavaScript test automation framework to handle AngularJS components in a way that better matches how developers use it.
For scripting, selenium locators are essential since if they're off, your automation scripts won't run. Therefore, in any testing framework, these Selenium locators are the foundation of your Selenium test automation efforts.
To make sure that your Selenium automation tests function as intended, debugging can be an effective option. Check the blog to know more.
If you are not familiar with writing Selenium test automation on Protractor, here is a blog for you to get you understand in depth.
Selenium tests are asynchronous and there are various reasons for a timeout to occur in a Protractor test. Find out how to handle timeouts in this Protractor tutorial.
In this Protractor tutorial, learn how to handle frames or iframes in Selenium with Protractor for automated browser testing.
Handle alerts and popups in Protractor more efficiently. It can be confusing. Here's a simple guide to understand how to handle alerts and popups in Selenium.
Get 100 minutes of automation test minutes FREE!!
