How to use getId method in Best

Best JavaScript code snippet using best

logicfunc.js

Source:logicfunc.js Github

copy

Full Screen

1// AnyChat for Web SDK2/********************************************3 * 业务逻辑控制 *4 *******************************************/5 var curWwwPath = window.document.location.hostname;6 7var mDefaultServerAddr = curWwwPath; 8// 默认服务器地址9var mDefaultServerPort = 8906; // 默认服务器端口号10var mSelfUserId = -1; // 本地用户ID11var mTargetUserId = -1; // 目标用户ID(请求了对方的音视频)12var mRefreshVolumeTimer; // 实时音量大小定时器13// 日志记录类型,在日志信息栏内显示不同的颜色14var LOG_TYPE_NORMAL = 0;15var LOG_TYPE_API = 1;16var LOG_TYPE_EVENT = 2;17var LOG_TYPE_ERROR = 3;18// 通知类型,在文字消息栏内显示不同的颜色19var NOTIFY_TYPE_NORMAL = 0;20var NOTIFY_TYPE_SYSTEM = 1;21function LogicInit() {22 setTimeout(function () {23 //检查是否安装了插件 24 var NEED_ANYCHAT_APILEVEL = "0"; // 定义业务层需要的AnyChat API Level25 var errorcode = BRAC_InitSDK(NEED_ANYCHAT_APILEVEL); //初始化插件26 AddLog("BRAC_InitSDK(" + NEED_ANYCHAT_APILEVEL + ")=" + errorcode, LOG_TYPE_API);27 if (errorcode == GV_ERR_SUCCESS) {28 ShowLoginDiv(true);29 AddLog("AnyChat Plugin Version:" + BRAC_GetVersion(0), LOG_TYPE_NORMAL);30 AddLog("AnyChat SDK Version:" + BRAC_GetVersion(1), LOG_TYPE_NORMAL);31 AddLog("Build Time:" + BRAC_GetSDKOptionString(BRAC_SO_CORESDK_BUILDTIME), LOG_TYPE_NORMAL);32 } else { // 没有安装插件,或是插件版本太旧,显示插件下载界面33 GetID("prompt_div").style.display = "block";34 SetDivTop("prompt_div", 300);35 if (errorcode == GV_ERR_PLUGINNOINSTALL)36 GetID("prompt_div_line1").innerHTML = "首次进入需要安装插件,请点击下载按钮进行安装!";37 else if (errorcode == GV_ERR_PLUGINOLDVERSION)38 GetID("prompt_div_line1").innerHTML = "检测到当前插件的版本过低,请下载安装最新版本!";39 }40 }, 500);41 //设置按钮42 GetID("setting").onclick = function () {43 if (GetID("setting_div").style.display == "block")44 GetID("setting_div").style.display = "none";45 else46 GetID("setting_div").style.display = "block";47 }48 //登录按钮49 GetID("loginbtn").onclick = function () {50 if (GetID("username").value != "") {51 DisplayLoadingDiv(true);52 var errorcode = BRAC_Connect(GetID("ServerAddr").value, parseInt(GetID("ServerPort").value)); //连接服务器53 AddLog("BRAC_Connect(" + GetID("ServerAddr").value + "," + GetID("ServerPort").value + ")=" + errorcode, LOG_TYPE_API);54 errorcode = BRAC_Login(GetID("username").value, GetID("password").value, 0);55 AddLog("BRAC_Login(" + GetID("username").value + ")=" + errorcode, LOG_TYPE_API);56 // 隐藏设置界面57 GetID("setting_div").style.display = "none";58 }59 else {60 GetID("a_error_user").style.color = "red";61 AddLog("The user name can not be empty!", LOG_TYPE_ERROR);62 GetID("username").focus();63 }64 }65 //退出系统66 GetID("ExitSystemBtn").onclick = function () {67 var errorcode = BRAC_Logout();68 AddLog("BRAC_Logout()=" + errorcode, LOG_TYPE_API);69 ShowHallDiv(false);70 ShowLoginDiv(true);71 }72 //退出房间73 GetID("leaveroom").onclick = function () {74 var errorcode = BRAC_LeaveRoom(-1);75 AddLog("BRAC_LeaveRoom(" + -1 + ")=" + errorcode, LOG_TYPE_API);76 clearInterval(mRefreshVolumeTimer); // 清除实时音量显示计时器77 ShowRoomDiv(false); // 隐藏房间界面78 ShowHallDiv(true); // 显示大厅界面79 mTargetUserId = -1;80 }81 //进入自定义房间82 GetID("EnterRoomBtn").onclick = function () {83 if (GetID("customroomid").value != "") {84 var re = /^[1-9]+[0-9]*]*$/; //判断是否纯数字85 if (re.test(GetID("customroomid").value)) {//纯数字86 EnterRoomRequest(parseInt(GetID("customroomid").value));87 } else {88 AddLog("Room ID must be number!", LOG_TYPE_ERROR);89 GetID("customroomid").value = "";90 GetID("customroomid").focus();91 }92 }93 }94 //发送信息按钮95 GetID("SendMsg").onclick = function () {96 SendMessage();97 }98 //回车键发送信息99 GetID("MessageInput").onkeydown = function (e) {100 e = e ? e : window.event; //键盘事件101 if (e.keyCode == 13 && GetID("MessageInput").value != "") {//回车键被点击且发送信息框不为空102 SendMessage();103 }104 }105 //下载插件按钮鼠标划入划出时间106 GetID("prompt_div_btn_load").onmouseover = function () {107 GetID("prompt_div_btn_load").style.backgroundColor = "#ffc200";108 }109 GetID("prompt_div_btn_load").onmouseout = function () {110 GetID("prompt_div_btn_load").style.backgroundColor = "#ff8100";111 }112 //下载插件界面关闭按钮113 GetID("prompt_div_headline2").onclick = function () {114 document.URL = location.href;115 }116 // 鼠标移到日志层上面117 GetID("LOG_DIV_BODY").onmousemove = function () {118 GetID("LOG_DIV_BODY").style.zIndex = 100;119 GetID("LOG_DIV_CONTENT").style.backgroundColor = "#FAFADD";120 GetID("LOG_DIV_CONTENT").style.border = "1px solid black";121 }122 // 鼠标从日志层上面移开123 GetID("LOG_DIV_BODY").onmouseout = function () {124 GetID("LOG_DIV_BODY").style.zIndex = -1;125 GetID("LOG_DIV_CONTENT").style.backgroundColor = "#C4CEDD";126 GetID("LOG_DIV_CONTENT").style.border = "";127 }128 //高级设置界面关闭按钮129 GetID("advanceset_div_close").onclick = function () {130 GetID("advanceset_div").style.display = "none";131 }132 //高级设置133 GetID("advancedsetting").onclick = function () {134 if (GetID("advanceset_div").style.display == "block")135 GetID("advanceset_div").style.display = "none";136 else {137 GetID("advanceset_div").style.display = "block"; // 显示高级设置界面138 // 初始化高级设置界面139 InitAdvanced();140 }141 }142}143//计算高度并设置界面位置144function SetDivTop(id, TheHeight) {145 var BodyHeight = document.documentElement.clientHeight; //获得浏览器可见区域高度146 if (TheHeight < BodyHeight) {//div高度小于可见区域高度147 GetID("margintop").style.height = (BodyHeight - TheHeight) / 4 + "px";148 GetID(id).style.marginTop = "0px";149 }150}151//系统信息框滚动条显隐152function DisplayScroll(id) {153 var offset = GetID(id); //需要检测的div154 if (offset.offsetHeight < offset.scrollHeight) {//div可见高度小于div滚动条高度155 GetID(id).style.overflowY = "scroll";//显示滚动条156 GetID(id).scrollTop = GetID(id).scrollHeight;//滚动条自动滚动到底部157 }158 else159 GetID(id).style.overflowY = "hidden";//隐藏滚动条160}161//发送信息162function SendMessage() {163 if (GetID("MessageInput").value != "") {//发送信息框不为空164 var Msg = GetID("MessageInput").value;165 BRAC_SendTextMessage(0, 0, Msg); //调用发送信息函数166 DisplayTextMessage(mSelfUserId, Msg);167 GetID("MessageInput").value = "";168 GetID("MessageInput").focus();169 }170}171// 显示文字消息172function DisplayTextMessage(fromuserid, message) {173 var namestr = BRAC_GetUserName(fromuserid) + "&nbsp" + GetTheTime();174 if(fromuserid==mSelfUserId)175 namestr = namestr.fontcolor("#008000");176 else177 namestr = namestr.fontcolor("#000080");178 message = message.fontcolor("#333333");179 var msgdiv = document.createElement("div");180 msgdiv.setAttribute("class", "TheMsgStyle");181 msgdiv.innerHTML = namestr + ":&nbsp&nbsp" + message;182 GetID("ReceiveMsgDiv").appendChild(msgdiv);183 DisplayScroll("ReceiveMsgDiv");184}185// 在文字消息区域显示通知信息186function ShowNotifyMessage(message, type) {187 if (type == NOTIFY_TYPE_SYSTEM) {188 message = message.fontcolor("#FF0000");189 } else {190 message = message.fontcolor("#333333");191 }192 var msgdiv = document.createElement("div");193 msgdiv.setAttribute("class", "TheMsgStyle");194 msgdiv.innerHTML = message + "&nbsp(" + GetTheTime().fontcolor("#999999") + ")";195 GetID("ReceiveMsgDiv").appendChild(msgdiv);196 DisplayScroll("ReceiveMsgDiv");197}198// 显示登录界面199function ShowLoginDiv(bShow) {200 if(bShow) {201 GetID("login_div").style.display = "block"; //显示登录界面202 GetID("username").focus();203 SetDivTop("login_div", 195); //登录界面垂直居中204 GetID("LOG_DIV_BODY").style.display = "block"; //显示系统信息框205 GetID("ServerAddr").value = mDefaultServerAddr;206 GetID("ServerPort").value = mDefaultServerPort;207 } else {208 209 }210}211// 显示大厅界面212function ShowHallDiv(bShow) {213 if (bShow) {214 GetID("room_div_userlist").innerHTML = ""; //清空房间界面好友列表215 GetID("login_div").style.display = "none"; //隐藏登录界面216 GetID("hall_div").style.display = "block"; //显示大厅界面217 GetID("customroomid").value = "";218 SetDivTop("hall_div", 400); //大厅界面垂直居中219 GetID("customroomid").focus();220 GetID("a_error_user").style.color = "#FAFADD";221 222 GetID("hall_div_td_name").innerHTML = BRAC_GetUserName(mSelfUserId);223 GetID("hall_div_td_id").innerHTML = mSelfUserId;224 GetID("hall_div_td_level").innerHTML = BRAC_GetUserLevel(mSelfUserId);225 GetID("hall_div_td_ip").innerHTML = BRAC_QueryUserStateString(mSelfUserId, BRAC_USERSTATE_LOCALIP);226 } else {227 GetID("hall_div").style.display = "none";228 }229}230// 显示房间界面231function ShowRoomDiv(bShow) {232 if (bShow) {233 GetID("hall_div").style.display = "none"; //隐藏大厅界面234 GetID("room_div").style.display = "block"; //显示房间界面235 SetDivTop("room_div", 610); //房间界面垂直居中236 GetID("MessageInput").focus();237 } else {238 GetID("advanceset_div").style.display = "none"; //隐藏高级设置界面239 GetID("ReceiveMsgDiv").innerHTML = ""; //清空房间界面信息接收框240 GetID("room_div").style.display = "none"; //隐藏房间界面241 }242}243// 请求进入指定的房间244function EnterRoomRequest(roomid) {245 var errorcode = BRAC_EnterRoom(roomid, "", 0); //进入房间246 AddLog("BRAC_EnterRoom(" + roomid + ")=" + errorcode, LOG_TYPE_API);247 if(errorcode == 0)248 DisplayLoadingDiv(true);249}250function GetID(id) {251 if (document.getElementById) {252 return document.getElementById(id);253 } else if (window[id]) {254 return window[id];255 }256 return null;257}258// 打开指定用户的音视频259function RequestOtherUserVideo(userid) {260 var userlist = GetID("room_div_userlist");261 // 获得用户列表中所有<a>标签262 var userdivobj = userlist.getElementsByTagName("div");263 for (var i = 0; i < userdivobj.length; i++) {264 userdivobj[i].style.backgroundColor = "White"; 265 }266 // 获取用户列表中所有<img>标签267 var userimgobj = userlist.getElementsByTagName("img");268 for (var j = 0; j < userimgobj.length; j++) {269 if (userimgobj[j].getAttribute("class") == "MicrophoneTag") { // 该图片为 话筒 图片270 userimgobj[j].src = "./images/advanceset/microphone_false.png";271 userimgobj[j].onclick = ""; // 删除话筒按钮点击事件272 userimgobj[j].style.cursor = "";273 }274 }275 // 判断是否需要关闭之前已请求的用户音视频数据276 if (mTargetUserId != -1) {277 BRAC_UserCameraControl(mTargetUserId, 0);278 BRAC_UserSpeakControl(mTargetUserId, 0);279 }280 GetID(userid + "_MicrophoneTag").src = "./images/advanceset/microphone_true.png"; // 点亮话筒图片281 GetID(userid + "_UserDiv").style.backgroundColor = "#E6E6E6"; //设置被点击<a>元素的字体颜色282 mTargetUserId = userid; //设置被点用户ID为全局变量283 BRAC_UserCameraControl(userid, 1); // 请求对方视频284 BRAC_UserSpeakControl(userid, 1); // 请求对方语音285 // 设置远程视频显示位置286 BRAC_SetVideoPos(userid, GetID("AnyChatRemoteVideoDiv"), "ANYCHAT_VIDEO_REMOTE");287 MicrophoneOnclick(userid); // 为当前视频会话用户话筒按钮添加点击事件288}289// 对列表中的用户进行添加、删除操作290function RoomUserListControl(userid, bInsert) {291 var userlist = GetID("room_div_userlist");292 if (bInsert) {293 var itemdiv = document.createElement("div");294 itemdiv.setAttribute("class", "UserListStyle");295 itemdiv.id = userid + "_UserDiv";296 // 判断用户摄像头状态297 if (BRAC_GetCameraState(userid) == 0)298 AddImage(itemdiv, userid + "_CameraTag", "CameraTag", "", userid); // 添加摄像头图片<img>标签299 if (BRAC_GetCameraState(userid) == 1)300 AddImage(itemdiv, userid + "_CameraTag", "CameraTag", "./images/advanceset/camera_false.png", userid); // 添加摄像头图片<img>标签301 if (BRAC_GetCameraState(userid) == 2)302 AddImage(itemdiv, userid + "_CameraTag", "CameraTag", "./images/advanceset/camera_true.png", userid); // 添加摄像头图片<img>标签303 // 判断当前ID是否为自己304 if (userid == mSelfUserId) {305 AddImage(itemdiv, mSelfUserId + "_MicrophoneTag", "mSelfMicrophoneTag", "./images/advanceset/microphone_true.png", userid); // 添加话筒图片<img>标签306 itemdiv.innerHTML += "&nbsp" + BRAC_GetUserName(mSelfUserId) + "(自己)";307 } else {308 AddImage(itemdiv, userid + "_MicrophoneTag", "MicrophoneTag", "./images/advanceset/microphone_false.png", userid); // 添加话筒图片<img>标签309 // 添加用户姓名<a>标签310 var a = document.createElement("a");311 a.id = userid + "_UserTag";312 a.title = BRAC_GetUserName(userid);313 a.innerHTML = BRAC_GetUserName(userid);314 a.href = "javascript:RequestOtherUserVideo(" + userid + ")";315 itemdiv.appendChild(a);316 }317 GetID("room_div_userlist").appendChild(itemdiv);318 MicrophoneOnclick(mSelfUserId);319 } else {320 var my = GetID(userid + "_UserDiv");321 userlist.removeChild(my);322 }323 DisplayScroll("room_div_userlist");324}325//div按钮鼠标划入划出效果326function Mouseover(id) {327 GetID(id).style.backgroundColor = "#FFFFCC";328}329//div按钮鼠标划入划出效果330function Mouseout(id) {331 GetID(id).style.backgroundColor = "#E6E6E6";332}333//获取当前时间 (00:00:00)334function GetTheTime() {335 var TheTime = new Date();336 return TheTime.toLocaleTimeString();337}338// 添加日志并显示,根据不同的类型显示不同的颜色339function AddLog(message, type) {340 if (type == LOG_TYPE_API) { // API调用日志,绿色341 message = message.fontcolor("Green");342 } else if(type == LOG_TYPE_EVENT) { // 回调事件日志,黄色343 message = message.fontcolor("#CC6600");344 } else if(type == LOG_TYPE_ERROR) { // 出错日志,红色345 message = message.fontcolor("#FF0000");346 } else { // 普通日志,灰色347 message = message.fontcolor("#333333");348 }349 GetID("LOG_DIV_CONTENT").innerHTML += message + "&nbsp" + GetTheTime().fontcolor("#333333") + "<br />";350 DisplayScroll("LOG_DIV_CONTENT");351}352// 显示等待进度条,提示用户操作正在进行中353function DisplayLoadingDiv(bShow) {354 if (bShow) {355 GetID("LOADING_DIV").style.display = "block";356 GetID("LOADING_GREY_DIV").style.display = "block";357 var TheHeight = document.documentElement.clientHeight;358 var TheWidth = document.body.offsetWidth;359 GetID("LOADING_DIV").style.marginTop = (TheHeight - 50) / 2 + "px";360 GetID("LOADING_DIV").style.marginLeft = (TheWidth - 130) / 2 + "px";361 }362 else {363 GetID("LOADING_DIV").style.display = "none";364 GetID("LOADING_GREY_DIV").style.display = "none";365 }366}367//好友 摄像头 话筒 图标368function AddImage(parent_id, img_id, img_class, fir_img, userid) {369 var imgs = document.createElement("img");370 imgs.id = img_id;371 imgs.className = img_class;372 imgs.src = fir_img;373 imgs.style.width = "15px";374 imgs.style.height = "15px";375 parent_id.appendChild(imgs);376}377// 为被点击用户话筒按钮添加点击事件378function MicrophoneOnclick(userid) {379 GetID(userid + "_MicrophoneTag").style.cursor = "pointer"; // 鼠标形状380 GetID(userid + "_MicrophoneTag").onclick = function () { // 话筒点击事件381 var ImgPath = GetID(userid + "_MicrophoneTag").src.split('/');382 if (ImgPath[ImgPath.length - 1] == "microphone_true.png") {383 GetID(userid + "_MicrophoneTag").src = "./images/advanceset/microphone_false.png";384 BRAC_UserSpeakControl(userid, 0); // 关闭语音385 }386 else {387 GetID(userid + "_MicrophoneTag").src = "./images/advanceset/microphone_true.png";388 BRAC_UserSpeakControl(userid, 1); // 开启语音389 }390 }...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

...42 }43 difficulty = num;44 easyBtn.style.border = '';45 for (let i = 1; i <= 81; i++) {46 getId(i).classList.remove('instance');47 }4849 startSudoku();50}5152function startSudoku() {53 clearCells();54 let gameBoard;55 gameBoard = difficulty_level;56 generateBoard(gameBoard);57}5859function generateBoard(gameBoard) {60 clearCells();61 clearDisableInput();6263 if (gameBoard == easy[0]) {64 answer = easy[1];65 }66 if (gameBoard == medium[0]) {67 answer = medium[1];68 }69 if (gameBoard == hard[0]) {70 answer = hard[1];71 }72 clearIncorrect();7374 for (var i = 0; i < 81; i++) {75 let x = gameBoard.charAt(i);76 if (x != '-') {77 getId(i + 1).value = x;78 getId(i + 1).disabled = true;79 getId('cell-' + (i + 1)).classList.add('disable');80 getId(i + 1).classList.remove('input-text');81 higlightedArea();82 } else {83 getId(i + 1).setAttribute('onkeyup', 'checkInput()');84 getId(i + 1).addEventListener('keyup', event => {85 instances(event);86 });87 getId(i + 1).addEventListener('keydown', event => {88 removeInstance(event);89 });90 }91 }92}9394function instances(event) {95 let val = event.target.value;96 for (let i = 1; i <= 81; i++) {97 if (val == getId(i).value && getId(i).value != '') {98 getId(i).classList.add('instance');99 }100 }101}102function removeInstance(event) {103 for (let i = 1; i <= 81; i++) {104 if (event.keyCode == 8) {105 getId(i).classList.remove('instance');106 }107 }108}109function clearCells() {110 for (let i = 1; i <= 81; i++) {111 getId(i).classList.remove('highlight', 'incorrect');112 getId(i).value = '';113 }114}115function higlightedArea() {116 for (let j = 1; j <= 81; j++) {117 getId(j).classList.remove('highlight', 'current-cell');118 }119}120function clearDisableInput() {121 for (var i = 1; i <= 81; i++) {122 getId(i).disabled = false;123 }124}125126const onClick = function () {127 let y = this.id;128129 higlightedArea();130 for (let i = 1; i <= 81; i++) {131 getId(i).classList.remove('instance');132 }133 getId(y).classList.add('current-cell');134135 // Higlighting rows and columns of the celected cell136 for (let q = 0; q < 81; ) {137 let c = y % 9;138 if (c == 0) {139 c = 9;140 }141 let e = q + c;142 getId(e).classList.add('highlight');143 q = q + 9;144 for (let x = 1; x <= 81; x++) {145 for (i = 0; i < 9; i++) {146 let j = i + 1;147 if (y / 9 > i && y / 9 <= j && x / 9 > i && x / 9 <= j) {148 getId(x).classList.add('highlight');149 }150 }151 }152 }153154 // (function for selecting 3x3 grid)155 box(y);156157 //getId(y).classList.remove("current-cell");158};159for (let l = 1; l <= 81; l++) {160 getId(l).onclick = onClick;161}162163function clearIncorrect() {164 for (let j = 1; j <= 81; j++) {165 getId(j).classList.remove('incorrect');166 }167}168function sudokuSolver() {169 var s = 0;170 for (var i = 1; i <= 81; i++) {171 getId(i).value = answer.charAt(s);172 s++;173 }174}175function box(y) {176 for (let i = 1; i <= 81; i++) {177 let d = y % 9;178 let s = i % 9;179 if (d == 1 || d == 2 || d == 3) {180 if (s == 1 || s == 2 || s == 3) {181 if (y <= 21 && i <= 21) {182 getId(i).classList.add('highlight');183 } else if (y > 21 && y <= 48 && i > 21 && i <= 48) {184 getId(i).classList.add('highlight');185 } else if (y > 48 && y <= 75 && i > 48 && i <= 75) {186 getId(i).classList.add('highlight');187 }188 }189 }190 if (d == 4 || d == 5 || d == 6) {191 if (s == 4 || s == 5 || s == 6) {192 if (y <= 24 && i <= 24) {193 getId(i).classList.add('highlight');194 } else if (y > 24 && y <= 51 && i > 24 && i <= 51) {195 getId(i).classList.add('highlight');196 } else if (y > 51 && y <= 78 && i > 51 && i <= 78) {197 getId(i).classList.add('highlight');198 }199 }200 }201 if (d == 7 || d == 8 || d == 0) {202 if (s == 7 || s == 8 || s == 0) {203 if (y <= 27 && i <= 27) {204 getId(i).classList.add('highlight');205 } else if (y > 27 && y <= 54 && i > 27 && i <= 54) {206 getId(i).classList.add('highlight');207 } else if (y > 54 && y <= 81 && i > 54 && i <= 81) {208 getId(i).classList.add('highlight');209 }210 }211 }212 }213}214215function checkRow() {216 for (let x = 1; x <= 81; x++) {217 for (let y = 1; y <= 81; y++) {218 if (x % 9 == y % 9 && x != y) {219 if (getId(x).value == getId(y).value) {220 getId(x).classList.add('incorrect');221 getId(y).classList.add('incorrect');222 }223 }224 }225 }226}227228function checkColumn() {229 for (let x = 1; x <= 81; x++) {230 for (let y = 1; y <= 81; y++) {231 for (let i = 0; i < 9; i++) {232 let j = i + 1;233 if (x / 9 <= j && y / 9 <= j && x / 9 > i && y / 9 > i && x != y) {234 if (getId(x).value == getId(y).value) {235 getId(x).classList.add('incorrect');236 getId(y).classList.add('incorrect');237 }238 }239 }240 }241 }242}243function checkBox() {244 let val = '';245 var idx = [];246 var a = 0;247 for (var i = 1; a < 3; i += 9) {248 a++;249 if (getId(i).value != '') {250 val += getId(i).value;251 idx.push(i);252 } else {253 val += '-';254 idx.push(i);255 }256 if (getId(i + 1).value != '') {257 val += getId(i + 1).value;258 idx.push(i + 1);259 } else {260 val += '-';261 idx.push(i + 1);262 }263 if (getId(i + 2).value != '') {264 val += getId(i + 2).value;265 idx.push(i + 2);266 } else {267 val += '-';268 idx.push(i + 2);269 }270 }271272 for (var j = 0; j < val.length; j++) {273 var check = val[j];274 if (check == '-') continue;275 for (var k = 0; k < val.length && k != j; k++) {276 if (val[k] == check) {277 console.log(idx[j], idx[k]);278279 getId(idx[j]).classList.add('incorrect');280 getId(idx[k]).classList.add('incorrect');281 }282 }283 }284285 //2nd box286 val = '';287 var idx = [];288 var a = 0;289 for (var i = 4; a < 3; i += 9) {290 a++;291 if (getId(i).value != '') {292 val += getId(i).value;293 idx.push(i);294 } else {295 val += '-';296 idx.push(i);297 }298 if (getId(i + 1).value != '') {299 val += getId(i + 1).value;300 idx.push(i + 1);301 } else {302 val += '-';303 idx.push(i + 1);304 }305 if (getId(i + 2).value != '') {306 val += getId(i + 2).value;307 idx.push(i + 2);308 } else {309 val += '-';310 idx.push(i + 2);311 }312 }313314 for (var j = 0; j < val.length; j++) {315 var check = val[j];316 if (check == '-') continue;317 for (var k = 0; k < val.length && k != j; k++) {318 if (val[k] == check) {319 console.log(idx[j], idx[k]);320321 getId(idx[j]).classList.add('incorrect');322 getId(idx[k]).classList.add('incorrect');323 }324 }325 }326 //3rd box327 val = '';328 var idx = [];329 var a = 0;330 for (var i = 7; a < 3; i += 9) {331 a++;332 if (getId(i).value != '') {333 val += getId(i).value;334 idx.push(i);335 } else {336 val += '-';337 idx.push(i);338 }339 if (getId(i + 1).value != '') {340 val += getId(i + 1).value;341 idx.push(i + 1);342 } else {343 val += '-';344 idx.push(i + 1);345 }346 if (getId(i + 2).value != '') {347 val += getId(i + 2).value;348 idx.push(i + 2);349 } else {350 val += '-';351 idx.push(i + 2);352 }353 }354355 for (var j = 0; j < val.length; j++) {356 var check = val[j];357 if (check == '-') continue;358 for (var k = 0; k < val.length && k != j; k++) {359 if (val[k] == check) {360 console.log(idx[j], idx[k]);361362 getId(idx[j]).classList.add('incorrect');363 getId(idx[k]).classList.add('incorrect');364 }365 }366 }367 //4th box368 val = '';369 var idx = [];370 var a = 0;371 for (var i = 28; a < 3; i += 9) {372 a++;373 if (getId(i).value != '') {374 val += getId(i).value;375 idx.push(i);376 } else {377 val += '-';378 idx.push(i);379 }380 if (getId(i + 1).value != '') {381 val += getId(i + 1).value;382 idx.push(i + 1);383 } else {384 val += '-';385 idx.push(i + 1);386 }387 if (getId(i + 2).value != '') {388 val += getId(i + 2).value;389 idx.push(i + 2);390 } else {391 val += '-';392 idx.push(i + 2);393 }394 }395396 for (var j = 0; j < val.length; j++) {397 var check = val[j];398 if (check == '-') continue;399 for (var k = 0; k < val.length && k != j; k++) {400 if (val[k] == check) {401 console.log(idx[j], idx[k]);402403 getId(idx[j]).classList.add('incorrect');404 getId(idx[k]).classList.add('incorrect');405 }406 }407 }408 //5th box409 val = '';410 var idx = [];411 var a = 0;412 for (var i = 31; a < 3; i += 9) {413 a++;414 if (getId(i).value != '') {415 val += getId(i).value;416 idx.push(i);417 } else {418 val += '-';419 idx.push(i);420 }421 if (getId(i + 1).value != '') {422 val += getId(i + 1).value;423 idx.push(i + 1);424 } else {425 val += '-';426 idx.push(i + 1);427 }428 if (getId(i + 2).value != '') {429 val += getId(i + 2).value;430 idx.push(i + 2);431 } else {432 val += '-';433 idx.push(i + 2);434 }435 }436437 for (var j = 0; j < val.length; j++) {438 var check = val[j];439 if (check == '-') continue;440 for (var k = 0; k < val.length && k != j; k++) {441 if (val[k] == check) {442 console.log(idx[j], idx[k]);443444 getId(idx[j]).classList.add('incorrect');445 getId(idx[k]).classList.add('incorrect');446 }447 }448 }449 //6th box//450 val = '';451 var idx = [];452 var a = 0;453 for (var i = 34; a < 3; i += 9) {454 a++;455 if (getId(i).value != '') {456 val += getId(i).value;457 idx.push(i);458 } else {459 val += '-';460 idx.push(i);461 }462 if (getId(i + 1).value != '') {463 val += getId(i + 1).value;464 idx.push(i + 1);465 } else {466 val += '-';467 idx.push(i + 1);468 }469 if (getId(i + 2).value != '') {470 val += getId(i + 2).value;471 idx.push(i + 2);472 } else {473 val += '-';474 idx.push(i + 2);475 }476 }477478 for (var j = 0; j < val.length; j++) {479 var check = val[j];480 if (check == '-') continue;481 for (var k = 0; k < val.length && k != j; k++) {482 if (val[k] == check) {483 console.log(idx[j], idx[k]);484485 getId(idx[j]).classList.add('incorrect');486 getId(idx[k]).classList.add('incorrect');487 }488 }489 }490 //7th box//491 val = '';492 var idx = [];493 var a = 0;494 for (var i = 55; a < 3; i += 9) {495 a++;496 if (getId(i).value != '') {497 val += getId(i).value;498 idx.push(i);499 } else {500 val += '-';501 idx.push(i);502 }503 if (getId(i + 1).value != '') {504 val += getId(i + 1).value;505 idx.push(i + 1);506 } else {507 val += '-';508 idx.push(i + 1);509 }510 if (getId(i + 2).value != '') {511 val += getId(i + 2).value;512 idx.push(i + 2);513 } else {514 val += '-';515 idx.push(i + 2);516 }517 }518519 for (var j = 0; j < val.length; j++) {520 var check = val[j];521 if (check == '-') continue;522 for (var k = 0; k < val.length && k != j; k++) {523 if (val[k] == check) {524 console.log(idx[j], idx[k]);525526 getId(idx[j]).classList.add('incorrect');527 getId(idx[k]).classList.add('incorrect');528 }529 }530 }531 //8th box//532 val = '';533 var idx = [];534 var a = 0;535 for (var i = 58; a < 3; i += 9) {536 a++;537 if (getId(i).value != '') {538 val += getId(i).value;539 idx.push(i);540 } else {541 val += '-';542 idx.push(i);543 }544 if (getId(i + 1).value != '') {545 val += getId(i + 1).value;546 idx.push(i + 1);547 } else {548 val += '-';549 idx.push(i + 1);550 }551 if (getId(i + 2).value != '') {552 val += getId(i + 2).value;553 idx.push(i + 2);554 } else {555 val += '-';556 idx.push(i + 2);557 }558 }559560 for (var j = 0; j < val.length; j++) {561 var check = val[j];562 if (check == '-') continue;563 for (var k = 0; k < val.length && k != j; k++) {564 if (val[k] == check) {565 console.log(idx[j], idx[k]);566567 getId(idx[j]).classList.add('incorrect');568 getId(idx[k]).classList.add('incorrect');569 }570 }571 }572 //9th box//573 val = '';574 var idx = [];575 var a = 0;576 for (var i = 61; a < 3; i += 9) {577 a++;578 if (getId(i).value != '') {579 val += getId(i).value;580 idx.push(i);581 } else {582 val += '-';583 idx.push(i);584 }585 if (getId(i + 1).value != '') {586 val += getId(i + 1).value;587 idx.push(i + 1);588 } else {589 val += '-';590 idx.push(i + 1);591 }592 if (getId(i + 2).value != '') {593 val += getId(i + 2).value;594 idx.push(i + 2);595 } else {596 val += '-';597 idx.push(i + 2);598 }599 }600601 for (var j = 0; j < val.length; j++) {602 var check = val[j];603 if (check == '-') continue;604 for (var k = 0; k < val.length && k != j; k++) {605 if (val[k] == check) {606 console.log(idx[j], idx[k]);607608 getId(idx[j]).classList.add('incorrect');609 getId(idx[k]).classList.add('incorrect');610 }611 }612 }613}614function checkInput() {615 clearIncorrect();616 checkRow();617 checkColumn();618 checkBox();619}620621function validate() {622 let count = 0;623 for (let i = 0; i < 81; i++) {624 if (answer.charAt(i) == getId(i + 1).value) {625 count++;626 }627 }628629 if (count == 81) {630 alert('Yes! Great Work ');631 clearCells();632 clearDisableInput();633 } else alert('Something Incorrect!! Try Again');634}635636//helper functions/637function getId(id) {638 return document.getElementById(id);639}640function query(selector) {641 return document.querySelector(selector);642}643function queryAll(selector) {644 return document.querySelectorAll(selector); ...

Full Screen

Full Screen

GlossaryList.js

Source:GlossaryList.js Github

copy

Full Screen

2let id = 0 3const getId = () => ++id4const GlossaryList= [5 {6 id: getId() ,7 word: "ad nauseam",8 definition: "referring to something that has been done or repeated so often that it has become annoying or tiresome.", 9 },10 {11 id: getId() ,12 word: "bratwurst",13 definition: "a type of fine German pork sausage that is typically fried or grilled.", 14 },15 {16 id: getId() ,17 word: "conniving",18 definition: "given to or involved in conspiring to do something immoral, illegal, or harmful.", 19 },20 {21 id: getId() ,22 word:"deign" ,23 definition: "do something that one considers to be beneath one's dignity.", 24 },25 {26 id: getId() ,27 word: "dun",28 definition: "of a dull grayish-brown color.", 29 },30 {31 id: getId() ,32 word:"feign" ,33 definition: "pretend to be affected by (a feeling, state, or injury)." , 34 },35 {36 id: getId() ,37 word: "gnarled" ,38 definition: "knobbly, rough, and twisted, especially with age." , 39 },40 {41 id: getId() ,42 word: "gnat" ,43 definition: "a small two-winged fly that resembles a mosquito. Gnats include both biting and nonbiting forms, and they typically form large swarms." , 44 },45 {46 id: getId() ,47 word: "gnathic" ,48 definition: "relating to the jaws." , 49 },50 {51 id: getId() ,52 word: "gnaw" ,53 definition: "bite at or nibble something persistently." , 54 },55 {56 id: getId() ,57 word: "gneiss" ,58 definition: "a metamorphic rock with a banded or foliated structure, typically coarse-grained and consisting mainly of feldspar, quartz, and mica." , 59 },60 {61 id: getId() ,62 word: "gnome" ,63 definition: "a legendary dwarfish creature supposed to guard the earth's treasures underground." , 64 },65 {66 id: getId() ,67 word: "gnomon" ,68 definition: "The projecting piece on a sundial that shows the time by the position of its shadow." , 69 },70 {71 id: getId() ,72 word: "gnostic" ,73 definition: "relating to knowledge, especially esoteric mystical knowledge." , 74 },75 {76 id: getId() ,77 word: "gnu" ,78 definition: "a large dark African antelope with a long head, a beard and mane, and a sloping back." , 79 },80 {81 id: getId() ,82 word: "grog" ,83 definition: "spirits (originally rum) mixed with water. informally: alcoholic drink, especially beer." , 84 },85 {86 id: getId() ,87 word: "knack" ,88 definition: "an acquired or natural skill at performing a task." , 89 },90 {91 id: getId() ,92 word: "knackwurst" ,93 definition: "a type of short, fat, highly seasoned German sausage." , 94 },95 {96 id: getId() ,97 word: "knapsack" ,98 definition: "a bag with shoulder straps, carried on the back, and typically made of canvas or other weatherproof material." , 99 },100 {101 id: getId() ,102 word: "knapweed" ,103 definition: "a tough-stemmed Eurasian plant that typically has purple thistle-like flower heads, occurring chiefly in grassland and on roadsides." , 104 },105 {106 id: getId() ,107 word: "knave" ,108 definition: "a dishonest or unscrupulous man." , 109 },110 {111 id: getId() ,112 word: "knawel" ,113 definition: "a low-growing inconspicuous plant of the pink family, growing in temperate regions of the northern hemisphere." , 114 },115 {116 id: getId() ,117 word: "knead" ,118 definition: "massage or squeeze with the hands." , 119 },120 {121 id: getId() ,122 word: "knell" ,123 definition: "the sound of a bell, especially when rung solemnly for a death or funeral." , 124 },125 {126 id: getId() ,127 word: "knickers" ,128 definition: "loose-fitting trousers gathered at the knee or calf." , 129 },130 {131 id: getId() ,132 word: "knish" ,133 definition: "a dumpling of dough that is stuffed with a filling and baked or fried." , 134 },135 {136 id: getId() ,137 word: "knobby" ,138 definition: "having or covered with small knobs; knobbly." , 139 },140 {141 id: getId() ,142 word: "knoll" ,143 definition: "a small hill or mound." ,144 source: 'Dictionary.com' 145 },146 {147 id: getId() ,148 word: "knots" ,149 definition: "a unit of speed equivalent to one nautical mile per hour, used especially of ships, aircraft, or winds." , 150 },151 {152 id: getId() ,153 word: "kobold" ,154 definition: "(in Germanic mythology) a spirit that haunts houses or lives underground in caves or mines." , 155 },156 {157 id: getId() ,158 word: "malign" ,159 definition: "evil in nature or effect; malevolent." , 160 },161 {162 id: getId() ,163 word: "nape" ,164 definition: "the back of a person's neck." , 165 },166 {167 id: getId() ,168 word: "naught" ,169 definition: "nothing." , 170 },171 {172 id: getId() ,173 word: "nausea" ,174 definition: "a feeling of sickness with an inclination to vomit." , 175 },176 {177 id: getId() ,178 word: "navel" ,179 definition: "a rounded knotty depression in the center of a person's belly caused by the detachment of the umbilical cord after birth; the umbilicus." , 180 },181 {182 id: getId() ,183 word: "nether" ,184 definition: "lower in position." , 185 },186 {187 id: getId() ,188 word: "neume" ,189 definition: "(in plainsong) a note or group of notes to be sung to a single syllable." , 190 },191 {192 id: getId() ,193 word: "niche" ,194 definition: "a specialized segment of the market for a particular kind of product or service. ALSO place (something) in a niche or recess." , 195 },196 {197 id: getId() ,198 word: "nicker" ,199 definition: "(of a horse) give a soft, low, breathy whinny." , 200 },201 {202 id: getId() ,203 word: "niger" ,204 definition: "Latin for 'black' " , 205 },206 {207 id: getId() ,208 word: "nimbus" ,209 definition: "a large gray rain cloud.' " , 210 },211 {212 id: getId() ,213 word: "nomad" ,214 definition: "a person who does not stay long in the same place; a wanderer.' " , 215 },216 {217 id: getId() ,218 word: "nosh" ,219 definition: "food." , 220 },221 {222 id: getId() ,223 word: "notch" ,224 definition: "an indentation or incision on an edge or surface. To score or achieve (something)." , 225 },226 {227 id: getId() ,228 word: "nub" ,229 definition: "Unknown. Used akin to tap, nab, or brush like 'grandma' nimbly squeezing my cheeks. " , 230 },231 {232 id: getId() ,233 word: "pell mell" ,234 definition: "recklessly hasty or disorganized; headlong.' " , 235 },236 {237 id: getId() ,238 word: "pneumatic" ,239 definition: "containing or operated by air or gas under pressure. " , 240 },241 {242 id: getId() ,243 word: "rune" ,244 definition: "a mark or letter of mysterious or magic significance. " , 245 },246 {247 id: getId() ,248 word: "vignette" ,249 definition: "a brief evocative description, account, or episode. " , 250 },251 ];...

Full Screen

Full Screen

JSManterAtividade.js

Source:JSManterAtividade.js Github

copy

Full Screen

...41<script type="text/javascript">42function preencheProxComboCnae( inPosicao ){43 document.frm.stCtrl.value = 'preencheProxComboCnae'; 44 document.frm.target = "oculto";45 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>&inPosicao='+inPosicao;46 document.frm.submit();47 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';48}49function preencheCombosCnae(){50 document.frm.stCtrl.value = 'preencheCombosCnae';51 document.frm.target = "oculto";52 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';53 document.frm.submit();54 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';55}56function preencheProxCombo( inPosicao ){57 document.frm.stCtrl.value = 'preencheProxCombo';58 document.frm.target = "oculto";59 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>&inPosicao='+inPosicao;60 document.frm.submit();61 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';62}63function preencheCombosAtividade(){64 document.frm.stCtrl.value = 'preencheCombosAtividade';65 document.frm.target = "oculto";66 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';67 document.frm.submit();68 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';69}70function preencheProxComboServico( inPosicaoServico ){71 document.frm.stCtrl.value = 'preencheProxComboServico';72 document.frm.target = "oculto";73 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>&inPosicaoServico='+inPosicaoServico;74 document.frm.submit();75 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';76}77function preencheCombosServico(){78 document.frm.stCtrl.value = 'preencheCombosServico';79 document.frm.target = "oculto";80 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';81 document.frm.submit();82 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';83}84function preencheServicoVigencia(){85 document.frm.stCtrl.value = 'preencheServicoVigencia';86 document.frm.target = "oculto";87 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';88 document.frm.submit();89 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';90}91function preencheVigencia(){92 var d = document.frm;93 d.stCtrl.value = 'preencheVigencia';94 d.target = "oculto";95 d.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';96 d.submit();97 d.target = "";98 d.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';99}100function buscaCodigoVigencia(){101 var d = document.frm;102 var stTarget = d.target;103 d.stCtrl.value = 'buscaCodigoVigencia';104 d.target = "oculto";105 d.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';106 d.submit();107 //d.target = "";108 d.target = stTarget;109 d.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';110}111function incluirServico(){112 var mensagem = validarServico();113 if ( mensagem == '' ){114 buscarValor('MontaServico');115 } else {116 alertaAviso(mensagem,'form','erro','<?=Sessao::getId();?>');117 return false;118 }119}120function buscarValor(tipoBusca){121 var stTarget = document.frm.target;122 var stAction = document.frm.action;123 document.frm.stCtrl.value = tipoBusca;124 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';125 document.frm.submit();126 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';127 document.frm.action = stAction;128 document.frm.target = stTarget;129}130function buscarCnae(){131 var stTarget = document.frm.target;132 var stAction = document.frm.action;133 document.frm.stCtrl.value = 'buscaCnae';134 document.frm.target = "oculto";135 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';136 document.frm.submit();137 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';138 document.frm.action = stAction;139 document.frm.target = stTarget;140}141function validarServico(){142 var mensagem = '';143 var d = document.frm;144 if ( d.stChaveServico.value == 0) {145 mensagem += "@Campo Servico inválido!( )";146 }147 return mensagem;148}149function limparSelectMultiplo(stSelecionado, stDisponivel){150 passaItem(stSelecionado, stDisponivel, 'tudo' );151}152function Limpar(){153 limpaFormulario();154 document.frm.reset();155 limparSelectMultiplo('inCodElementosSelecionados', 'inCodElementosDisponiveis');156 limparSelectMultiplo('inCodResponsaveisSelecionados', 'inCodResponsaveisDisponiveis');157 limparServicoGeral();158}159function limparServicoGeral() {160 var stTarget = document.frm.target;161 var stAction = document.frm.action;162 document.frm.stCtrl.value = 'limparServicoGeral';163 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';164 document.getElementById("spnServicoCadastrado").innerHTML = '';165 document.frm.submit();166 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';167 document.frm.action = stAction;168 document.frm.target = stTarget;169}170function limparServico() {171 var stTarget = document.frm.target;172 var stAction = document.frm.action;173 document.frm.stCtrl.value = 'limparServico';174 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';175 //document.getElementById("spnServicoCadastrado").innerHTML = '';176 document.frm.submit();177 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';178 document.frm.action = stAction;179 document.frm.target = stTarget;180}181function excluiDado(stControle, inId){182 var stTarget = document.frm.target;183 var stAction = document.frm.action;184 document.frm.stCtrl.value = stControle;185 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>&inId=' + inId;186 document.frm.submit();187 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';188 document.frm.action = stAction;189 document.frm.target = stTarget;190}191function Cancelar(){192<?php193$link = Sessao::read( "link" );194$stLink = "&pg=".$link["pg"]."&pos=".$link["pos"];195?>196 document.frm.target = "telaPrincipal";197 document.frm.action = "<?=$pgList.'?'.Sessao::getId().$stLink;?>";198 document.frm.submit();199}...

Full Screen

Full Screen

be.common.js

Source:be.common.js Github

copy

Full Screen

1integratedCKEDITOR('description-page', height = 200);2integratedCKEDITOR('description-page-introduce',height=200);3if ($('#btnBrowseImage').length) {4 var button1 = document.getElementById('btnBrowseImage');5 button1.onclick = function () {6 selectFileWithKCFinder('pathImage', 'showHinh');7 }8}9$('.ulti-copy').click(function () {10 var selected = [];11 $('input[type=checkbox][name=id\\[\\]]').each(function () {12 if ($(this).is(":checked")) {13 selected.push($(this).val());14 }15 });16 if (selected.length != 0) {17 $('input[name=listID]').val(selected);18 alert('Đã lưu sản phẩm');19 }20 else {21 alert('Mời bạn chọn sản phẩm');22 }23 console.log(selected);24 // alert(id[0]);25});26$('.ulti-paste').click(function () {27 if (!$('input[name=listID]').val()) {28 alert('Bạn chưa Sao Chép Hoặc Chưa chọn sản phẩm');29 }30 else {31 $('#formPaste').submit();32 }33});34// SEO35$("input[name='seo_keywords']").keyup(function () {36 var getidTitle = $("#seo-part .content .show-pattern .title");37 var getidDescription = $("#seo-part .content .show-pattern .description");38 var strKeyword = $(this).val();39 strKeyword = replace_special_character_by_comma(strKeyword);40 if (strKeyword.length > 3) {41 if (strKeyword.substr(strKeyword.length - 1)===strKeyword.substr(strKeyword.length - 2,1)) {42 strKeyword=strKeyword.substr(0,strKeyword.length - 1);43 }44 }45 $(this).val(strKeyword);46 showErrorSEO(strKeyword.toLowerCase(), getidTitle, getidDescription);47})48$("input[name='seo_title']").keyup(function () {49 var getidTitle = $("#seo-part .content .show-pattern .title");50 var getidDescription = $("#seo-part .content .show-pattern .description");51 var strKeyword = $("input[name='seo_keywords']").val();52 showErrorSEO(strKeyword.toLowerCase(), getidTitle, getidDescription);53 var getid = $("#seo-part .content .show-pattern .title");54 getid.html($(this).val());55 var titleWidth = getid.width();56 if (titleWidth > 600) {57 cutString(getid);58 var temp = getid.html().lastIndexOf(' ');59 getid.html(getid.html().substring(0, temp + 1) + '...');60 }61 resetSentence();62});63$("input[name='seo_title']").bind("paste", function (e) {64 var getid = $("#seo-part .content .show-pattern .title");65 var pasteText = e.originalEvent.clipboardData.getData('text');66 getid.html(pasteText);67 var titleWidth = getid.width();68 if (titleWidth > 600) {69 cutStringTitle(getid);70 var temp = getid.html().lastIndexOf(' ');71 getid.html(getid.html().substring(0, temp + 1) + '...');72 }73});74$("textarea[name='seo_description']").keyup(function () {75 var getid = $("#seo-part .content .show-pattern .description");76 var getidTitle = $("#seo-part .content .show-pattern .title");77 var getidDescription = $("#seo-part .content .show-pattern .description");78 var strKeyword = $("input[name='seo_keywords']").val();79 showErrorSEO(strKeyword.toLowerCase(), getidTitle, getidDescription);80 getid.html($(this).val());81 var descriptionLength = getid.html().length;82 if (descriptionLength > 150) {83 cutStringDescription(getid);84 var temp = getid.html().lastIndexOf(' ');85 getid.html(getid.html().substring(0, temp + 1) + '...');86 }87 resetSentence();88});89$("input[name='title']").keyup(function () {90 var link = change_alias($(this).val());91 link = link.replace(/\s/g, "-");92 $("span.link").html(getBaseURL() + link);93 resetSentence();94});95function cutStringTitle(element) {96 var widthStr = element.width();97 var newString = '';98 if (widthStr > 600) {99 newString = element.html().substring(0, element.html().length - 1);100 element.html(newString);101 cutStringTitle(element);102 }103}104function cutStringDescription(element) {105 var descriptionLength = element.html().length;106 if (descriptionLength > 150) {107 element.html(element.html().substring(0, element.html().length - 1));108 cutStringDescription(element);109 }110}111function showErrorSEO(strKeyword, getidTitle, getidDescription) {112 var li = "";113 $("ul.error-notice").css("display", 'block');114 if (strKeyword.length > 3) {115 var listKeywords = strKeyword.trim().split(',');116 listKeywords.forEach(function (i, idx, array) {117 if (!isNullOrEmpty(i)) {118 if (getidTitle.html().toLowerCase().indexOf(i.trim()) != -1) {119 var checkText = getidTitle.html().substring(0, i.length).toLowerCase();120 if (checkText.indexOf(i.trim()) == -1) {121 li += '<li class="near">Từ khóa [' + i.trim() + '] chứa trong title nhưng không nằm đầu câu<li>';122 return false;123 } else {124 li += '<li class="right">Từ khóa [' + i.trim() + '] chứa trong title<li>';125 return false;126 }127 return false;128 } else {129 li += '<li class="wrong">Từ khóa [' + i.trim() + '] không chứa trong title<li>';130 return false;131 }132 }133 });134 listKeywords.forEach(function (i, idx, array) {135 if (!isNullOrEmpty(i)) {136 if (getidDescription.html().toLowerCase().indexOf(i.trim()) == -1) {137 li += '<li class="wrong">Từ khóa [' + i.trim() + '] không chứa trong description<li>';138 } else {139 li += '<li class="right">Từ khóa [' + i.trim() + '] chứa trong description<li>';140 }141 }142 });143 $("ul.error-notice").html(li);144 } else {145 $("ul.error-notice").html('');146 }147}148function change_alias(alias) {149 var str = alias;150 str = str.toLowerCase();151 str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");152 str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");153 str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");154 str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");155 str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");156 str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");157 str = str.replace(/đ/g, "d");158 str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|\$|_|`|-|{|}|\||\\/g, " ");159 str = str.replace(/ + /g, " ");160 str = str.trim();161 return str;162}163function replace_special_character_by_comma(alias) {164 var str = alias;165 str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|\$|_|`|-|{|}|\||\\/g, ",");166 return str;167}168function resetSentence() {169 var getidTitle = $("#seo-part .content .show-pattern .title");170 var getidDescription = $("#seo-part .content .show-pattern .description");171 var getidLink = $("#seo-part .content .show-pattern .link");172 if (getidTitle.html().length == 0) {173 getidTitle.html("Quick Brown Fox and The Lazy Dog - Demo Site")174 }175 if (getidDescription.html().length == 0) {176 getidDescription.html("The story of quick brown fox and the lazy dog. An all time classic children's fairy tale that is helping people with typography and web design.")177 }178 if (getidLink.html().length == 0) {179 getidLink.html("example.com/the-quick-brown-fox")180 }181 if ($("input[name='title']").length == 0) {182 getidLink.html("example.com/the-quick-brown-fox")183 }184}185function isNullOrEmpty(s) {186 return (s == null || s === "");...

Full Screen

Full Screen

JSManterServidor.js

Source:JSManterServidor.js Github

copy

Full Screen

...40?>41<script type="text/javascript">42function incluirFoto(){43 document.frm.stCtrl.value = 'incluirFoto';44 document.frm.action = '<?=$pgOculIdentificacao;?>?<?=Sessao::getId();?>';45 document.frm.submit();46 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';47}48function excluirFoto(){49 document.frm.stCtrl.value = 'excluirFoto';50 document.frm.action = '<?=$pgOculIdentificacao;?>?<?=Sessao::getId();?>';51 document.frm.submit();52 document.frm.action = '<?=$pgProc;?>?<?=Sessao::getId();?>';53}54function buscaValor(tipoBusca,Aba){55 document.frm.stCtrl.value = tipoBusca;56 var stTraget = document.frm.target;57 var stAction = document.frm.action;58 document.frm.target = "oculto";59 switch( Aba ){60 case 1:61 document.frm.action = '<?=$pgOculIdentificacao;?>?<?=Sessao::getId();?>';62 break63 case 2:64 document.frm.action = '<?=$pgOculDocumentacao;?>?<?=Sessao::getId();?>';65 break66 case 3:67 document.frm.action = '<?=$pgOculContrato;?>?<?=Sessao::getId();?>';68 break69 case 4:70 document.frm.action = '<?=$pgOculPrevidencia;?>?<?=Sessao::getId();?>';71 break72 case 5:73 document.frm.action = '<?=$pgOculDependentes;?>?<?=Sessao::getId();?>';74 break75 case 6:76 document.frm.action = '<?=$pgOculAtributos;?>?<?=Sessao::getId();?>';77 break78 default:79 document.frm.action = '<?=$pgOcul;?>?<?=Sessao::getId();?>';80 break81 }82 document.frm.submit();83 document.frm.action = stAction;84 document.frm.target = stTraget85}86function alterarDado( stAcao, Aba, inLinha ){87 document.frm.stCtrl.value = stAcao;88 var stTraget = document.frm.target;89 document.frm.target = "oculto";90 var stAction = document.frm.action;91 switch( Aba ){92 case 1:93 document.frm.action = '<?=$pgOculIdentificacao;?>?<?=Sessao::getId();?>&inLinha='+inLinha;94 break95 case 2:96 document.frm.action = '<?=$pgOculDocumentacao;?>?<?=Sessao::getId();?>&inLinha='+inLinha;97 break98 case 3:99 document.frm.action = '<?=$pgOculContrato;?>?<?=Sessao::getId();?>&inLinha='+inLinha;100 break101 case 4:102 document.frm.action = '<?=$pgOculPrevidencia;?>?<?=Sessao::getId();?>&inLinha='+inLinha;103 break104 case 5:105 document.frm.action = '<?=$pgOculDependentes;?>?<?=Sessao::getId();?>&inLinha='+inLinha;106 break107 case 6:108 document.frm.action = '<?=$pgOculAtributos;?>?<?=Sessao::getId();?>&inLinha='+inLinha;109 }110 document.frm.submit();111 document.frm.action = stAction;112 document.frm.target = stTraget;113}114function executaFuncaoAjax( funcao, parametrosGET, sincrono ) {115 if( parametrosGET ) {116 stPag = '<?=$pgOcul;?>?<?=Sessao::getId();?>'+parametrosGET;117 } else {118 stPag = '<?=$pgOcul;?>?<?=Sessao::getId();?>';119 }120 if( sincrono ) {121 ajaxJavaScriptSincrono( stPag, funcao, '<?=Sessao::getId();?>' );122 } else {123 ajaxJavaScript( stPag, funcao );124 }125}...

Full Screen

Full Screen

test-jetpack-id.js

Source:test-jetpack-id.js Github

copy

Full Screen

1/* This Source Code Form is subject to the terms of the Mozilla Public2 * License, v. 2.0. If a copy of the MPL was not distributed with this3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */4"use strict";5var getID = require("jetpack-id/index");6exports["test Returns GUID when `id` GUID"] = assert => {7 var guid = "{8490ae4f-93bc-13af-80b3-39adf9e7b243}";8 assert.equal(getID({ id: guid }), guid);9};10exports["test Returns domain id when `id` domain id"] = assert => {11 var id = "my-addon@jetpack";12 assert.equal(getID({ id: id }), id);13};14exports["test allows underscores in name"] = assert => {15 var name = "my_addon";16 assert.equal(getID({ name: name }), `@${name}`);17};18exports["test allows underscores in id"] = assert => {19 var id = "my_addon@jetpack";20 assert.equal(getID({ id: id }), id);21};22exports["test Returns valid name when `name` exists"] = assert => {23 var id = "my-addon";24 assert.equal(getID({ name: id }), `@${id}`);25};26exports["test Returns null when `id` and `name` do not exist"] = assert => {27 assert.equal(getID({}), null)28}29exports["test Returns null when no object passed in"] = assert => {30 assert.equal(getID(), null)31}32exports["test Returns null when `id` exists but not GUID/domain"] = assert => {33 var id = "my-addon";34 assert.equal(getID({ id: id }), null);35}36exports["test Returns null when `id` contains multiple @"] = assert => {37 assert.equal(getID({ id: "my@addon@yeah" }), null);38};39exports["test Returns null when `id` or `name` specified in domain format but has invalid characters"] = assert => {40 [" ", "!", "/", "$", " ", "~", "("].forEach(sym => {41 assert.equal(getID({ id: "my" + sym + "addon@domain" }), null);42 assert.equal(getID({ name: "my" + sym + "addon" }), null);43 });44};45exports["test Returns null, does not crash, when providing non-string properties for `name` and `id`"] = assert => {46 assert.equal(getID({ id: 5 }), null);47 assert.equal(getID({ name: 5 }), null);48 assert.equal(getID({ name: {} }), null);49};...

Full Screen

Full Screen

useTodos.js

Source:useTodos.js Github

copy

Full Screen

1import update from "immutability-helper"2export function getDefaultTodos({ getId } = {}) {3 return [4 {5 ...(getId && { id: getId() }),6 text: "Complete online JavaScript course",7 completed: true,8 },9 {10 ...(getId && { id: getId() }),11 text: "Jog around the park 3x",12 completed: false,13 },14 {15 ...(getId && { id: getId() }),16 text: "10 minutes meditation",17 completed: false,18 },19 {20 ...(getId && { id: getId() }),21 text: "Read for 1 hour",22 completed: false,23 },24 {25 ...(getId && { id: getId() }),26 text: "Pick up groceries",27 completed: false,28 },29 {30 ...(getId && { id: getId() }),31 text: "Complete Todo App on Frontend Mentor",32 completed: false,33 },34 ]35}36export function useTodos(state, { getId } = {}) {37 const [todos, setTodos] = state38 if (!todos || !setTodos) {39 const noop = () => {}40 return [todos, noop, noop, noop, noop, noop]41 }42 const addTodo = ({ text }) => {43 setTodos([44 ...todos,45 { ...(getId && { id: getId() }), text, completed: false },46 ])47 }48 const moveTodo = ({ oldIndex, newIndex }) => {49 if (newIndex !== oldIndex) {50 const newTodos = update(todos, {51 $splice: [52 [oldIndex, 1],53 [newIndex, 0, todos[oldIndex]],54 ],55 })56 setTodos(newTodos)57 }58 }59 const updateTodo = ({ index, completed }) => {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestId = require('./bestId');2var bestId = new BestId();3console.log(bestId.getId());4var BestId = require('./bestId');5var bestId = new BestId();6console.log(bestId.getId());7var BestId = require('./bestId');8var bestId = new BestId();9console.log(bestId.getId());10var BestId = require('./bestId');11var bestId = new BestId();12console.log(bestId.getId());13var BestId = require('./bestId');14var bestId = new BestId();15console.log(bestId.getId());16var BestId = require('./bestId');17var bestId = new BestId();18console.log(bestId.getId());19var BestId = require('./bestId');20var bestId = new BestId();21console.log(bestId.getId());22var BestId = require('./bestId');23var bestId = new BestId();24console.log(bestId.getId());25var BestId = require('./bestId');26var bestId = new BestId();27console.log(bestId.getId());28var BestId = require('./bestId');29var bestId = new BestId();30console.log(bestId.getId());31var BestId = require('./bestId');32var bestId = new BestId();33console.log(bestId.getId());34var BestId = require('./bestId');35var bestId = new BestId();36console.log(bestId.getId());

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestBuy = require('./bestbuy.js');2var bestBuy = new BestBuy();3console.log(bestBuy.getId());4var BestBuy = require('./bestbuy.js');5var bestBuy = new BestBuy();6console.log(bestBuy.getId());7var BestBuy = require('./bestbuy.js');8var bestBuy = new BestBuy();9console.log(bestBuy.getId());10var BestBuy = require('./bestbuy.js');11var bestBuy = new BestBuy();12console.log(bestBuy.getId());13var BestBuy = require('./bestbuy.js');14var bestBuy = new BestBuy();15console.log(bestBuy.getId());16var BestBuy = require('./bestbuy.js');17var bestBuy = new BestBuy();18console.log(bestBuy.getId());19var BestBuy = require('./bestbuy.js');20var bestBuy = new BestBuy();21console.log(bestBuy.getId());22var BestBuy = require('./bestbuy.js');23var bestBuy = new BestBuy();24console.log(bestBuy.getId());25var BestBuy = require('./bestbuy.js');26var bestBuy = new BestBuy();27console.log(bestBuy.getId());28var BestBuy = require('./bestbuy.js');29var bestBuy = new BestBuy();30console.log(bestBuy.getId());31var BestBuy = require('./bestbuy.js');32var bestBuy = new BestBuy();33console.log(bestBuy.getId());34var BestBuy = require('./bestbuy.js');35var bestBuy = new BestBuy();36console.log(bestBuy.getId());

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestFriend = require('./BestFriend.js');2var friend = new BestFriend();3console.log(friend.getId());4function BestFriend() {5 this.id = 12345;6}7BestFriend.prototype.getId = function() {8 return this.id;9}10module.exports = BestFriend;11You can also use the following syntax to import the class and use its methods:12const BestFriend = require('./BestFriend.js');13const friend = new BestFriend();14console.log(friend.getId());

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestTime = require('./besttime');2var bt = new BestTime();3var id = bt.getId();4console.log(id);5var BestTime = require('./besttime');6var bt = new BestTime();7var id = bt.getId();8console.log(id);9var BestTime = require('./besttime');10var bt = new BestTime();11var id = bt.getId();12console.log(id);13var BestTime = require('./besttime');14var bt = new BestTime();15var id = bt.getId();16console.log(id);17var BestTime = require('./besttime');18var bt = new BestTime();19var id = bt.getId();20console.log(id);21var BestTime = require('./besttime');22var bt = new BestTime();23var id = bt.getId();24console.log(id);25var BestTime = require('./besttime');26var bt = new BestTime();27var id = bt.getId();28console.log(id);29var BestTime = require('./besttime');30var bt = new BestTime();31var id = bt.getId();32console.log(id);33var BestTime = require('./besttime');34var bt = new BestTime();35var id = bt.getId();36console.log(id);37var BestTime = require('./besttime');38var bt = new BestTime();39var id = bt.getId();40console.log(id);41var BestTime = require('./besttime');42var bt = new BestTime();43var id = bt.getId();44console.log(id);45var BestTime = require('./besttime');46var bt = new BestTime();47var id = bt.getId();48console.log(id);49var BestTime = require('./besttime');50var bt = new BestTime();51var id = bt.getId();52console.log(id);53var BestTime = require('./besttime');54var bt = new BestTime();55var id = bt.getId();56console.log(id);

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestFriend = require("./test3.js");2var myBestFriend = new BestFriend("John", "Doe");3console.log(myBestFriend.getId());4var BestFriend = function(firstName, lastName) {5 this.firstName = firstName;6 this.lastName = lastName;7 this.getId = function() {8 return "My best friend is " + this.firstName + " " + this.lastName;9 }10}11module.exports = BestFriend;12var BestFriend = require("./test3.js");13var myBestFriend = new BestFriend("John", "Doe");14console.log(myBestFriend.getId());15var BestFriend = require("./test3.js");16var myBestFriend = new BestFriend("John", "Doe");17console.log(myBestFriend.getId());18var BestFriend = function(firstName, lastName) {19 this.firstName = firstName;20 this.lastName = lastName;21 this.getId = function() {22 return "My best friend is " + this.firstName + " " + this.lastName;23 }24}25module.exports = BestFriend;26var BestFriend = require("./test3.js");27var myBestFriend = new BestFriend("John", "Doe");28console.log(myBestFriend.getId());29var BestFriend = require("./test3.js");30var myBestFriend = new BestFriend("John", "Doe");31console.log(myBestFriend.getId());32var BestFriend = require("./test3.js");33var myBestFriend = new BestFriend("John", "Doe");34console.log(myBestFriend.getId());35var BestFriend = require("./test3.js");36var myBestFriend = new BestFriend("John", "Doe");37console.log(myBestFriend.getId());

Full Screen

Using AI Code Generation

copy

Full Screen

1var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);2console.log(bestSeller.getId());3var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);4console.log(bestSeller.getId());5var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);6console.log(bestSeller.getAuthor());7var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);8console.log(bestSeller.getAuthor());9var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);10console.log(bestSeller.getYear());11var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);12console.log(bestSeller.getYear());13var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);14console.log(bestSeller.getBookTitle());15var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);16console.log(bestSeller.getBookTitle());17var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);18console.log(bestSeller.getBookInfo());19var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);20console.log(bestSeller.getBookInfo());21var bestSeller = new BestSeller("The Hunger Games", "Suzanne Collins", 2008);22console.log(bestSeller.getBookInfo());

Full Screen

Using AI Code Generation

copy

Full Screen

1var bestSeller = new BestSeller();2var bestSeller = new BestSeller();3var bestSeller = new BestSeller();4var bestSeller = new BestSeller();5var bestSeller = new BestSeller();6var bestSeller = new BestSeller();7var bestSeller = new BestSeller();8var bestSeller = new BestSeller();9var bestSeller = new BestSeller();10var bestSeller = new BestSeller();11var bestSeller = new BestSeller();

Full Screen

Using AI Code Generation

copy

Full Screen

1var getId = require('./BestId');2console.log(getId());3var getId = function(){4 return "1234";5}6module.exports = getId;7var fs = require('fs');8var getId = require('./BestId');9console.log(getId());10var fs = require('fs');11fs.readFile('testfile.txt', function(err, data) {12 if (err) {13 console.log(err);14 } else {15 console.log(data);16 }17});

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 Best 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