How to use searchSpanList method in tracetest

Best JavaScript code snippet using tracetest

module.js

Source:module.js Github

copy

Full Screen

1import { setCookie, createNoneMessageAllchild, removeAllchild, pageNavDataSet} from '/js/common.js';2let con = true3function SearchInfoController() {4 const searchMainForm = document.getElementById("searchForms")5 const children = Array.from(searchMainForm.children)6 const inputList = document.getElementById('searchmodal')7 const parserCountryList = JSON.parse(localStorage.getItem("ctl"));8 children.forEach(child => {9 if (!child.value) {10 child.setAttribute("disabled", "disabled")11 }12 })13 // 검색창 체크14 function searchInputText() {15 const queryInput = document.getElementById("query")16 // let boolCheck = false17 document.querySelectorAll("input[name=queryInput]").forEach(querys =>18 querys.addEventListener('keyup', function () {19 if (querys.value.length > 0) {20 queryInput.value = querys.value;21 queryInput.removeAttribute('disabled')22 } else {23 queryInput.value = "";24 queryInput.setAttribute("disabled", "disabled")25 }26 }))27 }28 // 나라 데이터 29 function searchCountryFetch() {30 if (!parserCountryList) {31 fetch("/api/find/country")32 .then((response) => response.json())33 .then((countryData) => {34 let countryList = [];35 for (const data of countryData) {36 countryList.push({ label: data.countryKo, value: data.countryId })37 }38 localStorage.setItem("ctl", JSON.stringify(countryList))39 });40 }41 // 자동완성42 const field = document.getElementById('countryInput')43 const fieldCountry = document.getElementById('country')44 const ac = new Autocomplete(field, {45 data: parserCountryList,46 maximumItems: 5,47 threshold: 1,48 onSelectItem: ({ label, value }) => {49 field.value = label50 fieldCountry.value = value51 fieldCountry.removeAttribute('disabled')52 }53 });54 // 필드55 field.addEventListener('input', function () {56 let lastLen = field.value.slice(-1, field.value.length)57 let firstLen = field.value.slice(field.value.length - 2, field.value.length - 1)58 if (field.value.length > 0) {59 fieldCountry.value = field.value60 fieldCountry.removeAttribute('disabled')61 } else {62 fieldCountry.value = ""63 }64 if (lastLen == firstLen && field.value.length > 1) {65 field.value = field.value.slice(0, -1)66 this.blur()67 this.focus()68 }69 })70 // 데이타 이름변환71 const searchSpanList = document.querySelector('#searchSpanList')72 if (searchSpanList) {73 searchSpanList.querySelectorAll('span b').forEach(e => {74 parserCountryList.forEach(country => {75 if (country.value == e.innerText) {76 e.innerText = country.label77 field.value = country.label78 return;79 }80 })81 });82 }83 }84 // 검색창85 function timeSubMitCon() {86 let timeSubLodingImg = document.getElementById("lodingImg")87 timeSubLodingImg.removeAttribute("class")88 con = false89 setTimeout(function () {90 timeSubLodingImg.setAttribute("class", "d-none")91 wineSearchFind(0)92 }, 1000);93 //지연94 }95 function submitForm() {96 const searchForm = document.getElementById('queryInput')97 searchForm.addEventListener('keydown', (e) => {98 if (e.keyCode === 13 && con) {99 timeSubMitCon()100 }101 })102 }103 function modalForm() {104 const modalFormInput = document.getElementById("modalInputCheck")105 modalFormInput.addEventListener('click', () => {106 if (con) {107 spanTypeCreateList()108 timeSubMitCon()109 }110 })111 }112 // 상세 검색 속성 체크113 function searchConditonCheck() {114 const searchDetails = document.querySelectorAll("input~label")115 // let searchChecked = document.querySelectorAll("input[checked]")116 // searchChecked.forEach(check => {117 // searchCheck(check.name,check.value)118 // })119 searchDetails.forEach(details => details.addEventListener('click', function () {120 details.previousElementSibling.setAttribute('checked', false)121 searchCheck(details.previousElementSibling.name, details.previousElementSibling.value)122 }));123 }124 // 검색 초기화125 function deselect() {126 document.getElementById("none").addEventListener('click', () => {127 let searchCheckList = Array.from(inputList.getElementsByTagName('input'))128 deselectFor(searchCheckList, children)129 });130 };131 // 타입 체킹132 function spanTypeCreateList() {133 removeAllchild(searchSpanList)134 if (window.location.pathname == "/wine") {135 children.forEach(e => {136 if (e.disabled == false) {137 if (e.value && e.name != "type" && e.name != "page" && e.name != "query") {138 let spanTypeCreate = document.createElement("span");139 spanTypeCreate.setAttribute("class", "shadow-sm mx-1 input-group-text bg-white col-auto py-1 fw-bold")140 spanTypeCreate.innerText = typeInputCheck(e)141 searchSpanList.prepend(spanTypeCreate);142 }143 }144 })145 }146 }147 // 문자 변환148 /*149 내부 변수 모집150 */151 // 체크 인풋152 const inputPlaceHolderText = document.getElementById("queryInfoName")153 const searchCheck = function searchChecked(id, value) {154 let holderMsg = ""155 children.forEach(child => {156 if (child.id == id) {157 child.value = value;158 child.removeAttribute("disabled")159 if (child.value == "producerName") {160 holderMsg = "영문명으로 생산자 입력"161 }162 if (child.value == "contents") {163 holderMsg = "와인 내용으로 검색"164 }165 inputPlaceHolderText.placeholder = holderMsg166 }167 })168 }169 // 타입 도출170 const field = document.getElementById('countryInput')171 const typeInputCheck = (type) => {172 let valueLabel173 switch (type.id) {174 case "country":175 parserCountryList.forEach(e => {176 if (e.value == type.value) {177 valueLabel = e.label178 // 인풋179 field.value = e.label180 }181 })182 break183 case "colour":184 if (type.value == "red")185 valueLabel = "레드"186 else if (type.value == "white")187 valueLabel = "화이트"188 else if (type.value == "rose")189 valueLabel = "로제"190 break191 case "attr":192 if (type.value == "producerName")193 valueLabel = "생산자"194 else if (type.value == "contents")195 valueLabel = "내용"196 break197 case "subType":198 if (type.value == "sparkling")199 valueLabel = "스파클링"200 else if (type.value == "port")201 valueLabel = "포트"202 break203 }204 return valueLabel205 }206 // 검색 초기화207 const deselectFor = function deselectFor(searchCheckList, children) {208 const inputNotQuery = document.getElementById("queryInput")209 searchCheckList.forEach(e => { // 원래 초기화210 if (e.name == 'queryInput' || e.name == "country") {211 e.value = ""212 }213 e.checked = false214 });215 children.forEach(e => { // 메인 초기화216 if (e.name != 'type' && e.name != 'page') {217 e.value = "";218 e.setAttribute('disabled', 'disabled')219 inputPlaceHolderText.placeholder = "영문명 또는 한글명"220 }221 });222 }223 return {224 input: searchInputText(),225 submit: submitForm(),226 check: searchConditonCheck(),227 deselect: deselect(),228 searchCountryFetch: searchCountryFetch(),229 spanTypeCreateList: spanTypeCreateList(),230 modalForm: modalForm()231 }232}233export { SearchInfoController }234// -----------------------------------------------------------------235// 검색236 function wineSearchFind(pagenum) {237 const searchMainForm = document.getElementById("searchForms")238 const children = Array.from(searchMainForm.children)239 const mainContentChangeDivEl = document.getElementById("mainContentChangeDiv")240 const mainContentDivCard = document.createElement("div")241 const tastingMessageDiv = document.getElementById("sectiontastingMassage")242 const searchBodyCard = document.getElementById("searchMsgBodyCard")243 searchBodyCard.removeAttribute("class")244 // 메세지 제거245 removeAllchild(searchBodyCard)246 var object = {};247 children.forEach(function (value) {248 object[value.name] = value.value;249 });250 if (pagenum > 0) { object['page'] = pagenum }251 let url = '/api/find/wine'252 fetch(url, {253 method: 'POST',254 headers: { 'Content-Type': 'application/json' },255 body: JSON.stringify(object),256 })257 .then(e => e.json())258 .then(json => {259 if (json.totalElements != 0) {260 mainContentDivCard.setAttribute("class", "card box-shadow mx-auto px-auto")261 mainContentDivCard.setAttribute("style", "width: 16rem;")262 mainContentDivCard.setAttribute("th:data-columns", "modal")263 if (tastingMessageDiv != null) {264 tastingMessageDiv.remove()265 }266 // 메인 제거267 removeAllchild(mainContentChangeDivEl)268 for (let i = 0; i < json.numberOfElements; i++) {269 let starList = ''270 for (let j = 1; j <= 5; j++) {271 starList += `<i style="color: #4249a9" class="bi` + (json.content[i].averageScore / 20 >= j ? ' bi-star-fill ' : ((json.content[i].averageScore % 20 != 0) && ((json.content[i].averageScore / 20) + 1) >= j ? ' bi-star-half ' : ' bi-star ')) + `fs-5"></i>`272 }273 mainContentDivCard.innerHTML = `274 <img src="` + json.content[i].wineImageUrl + `" class="card-img-top" alt="...">275 <div class="card-body px-2">276 <h6 style='color: #2b68e3'>`+ json.content[i].averageScore + ' / 100' + `</h6>277 `+ starList + `278 <h5 class="card-title">` + json.content[i].displayName + `</h5>279 <h6 class="card-sub-title">` + json.content[i].displayNameKo + `</h6>280 <hr>281 <p class="card-text">`+ json.content[i].contents + `</p>282 </div>283 `284 // 번호285 mainContentDivCard.setAttribute("data-columnNum", json.content[i].wineId)286 // 공동287 mainContentChangeDivEl.appendChild(mainContentDivCard.cloneNode(true));288 con = true289 }290 // 컨텐츠 이동291 mainContentChangeDivEl.querySelectorAll('div[data-columnNum]').forEach(e => { // 공통292 e.addEventListener('click', () => {293 location.href = "wine/" + (json.pageable.pageNumber + 1) + "/" + e.dataset.columnnum + "/" + 1294 })295 })296 pageNavDataSet('wineListPageList', wineSearchFind, 0, json)297 } else {298 const searchMsgDiv = document.getElementById("wineSearchMsg")299 removeAllchild(mainContentChangeDivEl)300 removeAllchild(document.getElementById('wineListPageList'))301 createNoneMessageAllchild(mainContentChangeDivEl, searchBodyCard, searchMsgDiv, `302 <div class="card-header">303 <h4 class="card-title">메세지</h4>304 </div>305 <div class="card-body"><b>검색 결과가 존재하지 않습니다.</b>306 </div>`)307 con = true308 }309 }).catch(() => {310 const searchMsgDiv = document.getElementById("wineSearchMsg")311 removeAllchild(mainContentChangeDivEl)312 removeAllchild(document.getElementById('wineListPageList'))313 createNoneMessageAllchild(mainContentChangeDivEl, searchBodyCard, searchMsgDiv, `314 <div class="card-header">315 <h4 class="card-title">메세지</h4>316 </div>317 <div class="card-body"><b>최소 검색 단어는 2글자 이상입니다.</b>318 </div>`)319 con = true320 })321}322export function passFindEmail() {323 // const findForm = Array.from(document.getElementById('passResetInputForm').children)324 var object = {};325 const findInputList = document.querySelectorAll('#findInputList input')326 findInputList.forEach(e => {327 e.addEventListener('input', data => {328 if (data.target.name == 'username') {329 object[data.target.name] = data.target.value;330 } else if (data.target.name == 'email') {331 object[data.target.name] = data.target.value;332 }333 })334 })335 const inputButtenResult = document.getElementById('findPassWordReset')336 const findPassWordCon = document.getElementById('findPassWordCon')337 findPassWordCon.addEventListener('click', () => {338 if ('username' in object && 'username' in object) {339 let url = '/api/find/pass'340 fetch(url, {341 method: 'POST',342 headers: { 'Content-Type': 'application/json' },343 body: JSON.stringify(object)344 }).then(function (response) {345 if (!response.ok) {346 response.json().then(res => {347 return res348 }).then(res => {349 Object.keys(res).forEach(data => {350 findInputList.forEach(value => {351 if (data == value.name) {352 value.nextElementSibling.innerText = res[data]353 }354 })355 })356 })357 } else {358 findInputList.forEach(e => e.value = '')359 inputButtenResult.click()360 const findPassWordResetMsg = document.getElementById("findPassWordResetMsg")361 response.json().then(res => { return res }).then(res => {362 findPassWordResetMsg.innerText = res['message']363 })364 }365 });366 }367 })368}369//----------------------------------------------------------------//370function tastingPostSubmitContents(methods, postNum) {371 // 기본 문자들372 const titleValueText = document.getElementById("tastingTitle")373 const ContentsValueText = document.getElementById("tastingContents")374 const vintageValueText = document.getElementById("tastingVintage")375 const alcoholValueText = document.getElementById("tastingAlcohol")376 const priceValueText = document.getElementById("tastingPrice")377 const tastingBtnSumbit = document.getElementById("tastingBtnSumbit")378 const itemIdSet = document.querySelector("span[data-columns]")379 // 토탈 별 체크 레이팅380 const rangeValueBtt = document.getElementById("userTotalRagneValue")381 const rangeValueText = document.getElementById("totalCountValue")382 const starPointIcon = document.querySelectorAll("#starPointIcon i")383 function rangeInputChange() {384 rangeValueText.innerText = rangeValueBtt.value + " / 100"385 let rangeV = rangeValueBtt.value / 20386 for (let i = starPointIcon.length; 0 <= i; i--) {387 if (Math.floor(rangeV) > i)388 starPointIcon[i].classList = "bi bi-star-fill fa-2x"389 else if (rangeV >= i + 0.5)390 starPointIcon[i].classList = "bi bi-star-half fa-2x"391 else if (i != 0)392 starPointIcon[i - 1].classList = "bi bi-star fa-2x"393 }394 }395 // 변경시396 rangeValueBtt.oninput = function () {397 rangeInputChange()398 }399 // 초기값400 rangeInputChange()401 function formInputNotCheck() {402 if (titleValueText.value == '' && ContentsValueText.value == '' && alcoholValueText.value == ''403 && rateCheckItem(acidityRate) == '' && rateCheckItem(bodyRate) == ''404 && rateCheckItem(sugarRate) == '' && priceValueText.value == '') {405 document.getElementById('postModalBtt').click()406 return false407 }408 return true409 }410 // 별 체크 레이팅411 const acidityRate = document.getElementsByName("acidityEat")412 const bodyRate = document.getElementsByName("bodyEat")413 const sugarRate = document.getElementsByName("sugarEat")414 function rateCheckItem(item) {415 let itemNum = ""416 item.forEach(e => { if (e.checked) itemNum = e.value })417 return itemNum418 }419 tastingBtnSumbit.addEventListener('click', () => {420 if (formInputNotCheck()) {421 let numberInfo = tastingPostCall()422 if (numberInfo != null)423 location.href = "/post/info/" + numberInfo + "/1"424 }425 })426 function tastingPostCall() {427 let url = '/api/v1/post'428 return fetch(url, {429 method: methods,430 headers: { 'Content-Type': 'application/json' },431 body: JSON.stringify({432 idPostData: postNum,433 titPostData: titleValueText.value,434 conPostData: ContentsValueText.value,435 vinPostData: vintageValueText.value,436 alcPostData: alcoholValueText.value,437 aciPostData: rateCheckItem(acidityRate),438 bodyPostData: rateCheckItem(bodyRate),439 sugPostData: rateCheckItem(sugarRate),440 scPostData: rangeValueBtt.value,441 priPostData: priceValueText.value,442 winePostData: itemIdSet.dataset.columns443 }),444 }).then(function (response) {445 if (!response.ok) {446 document.getElementById('postModalBtt').click()447 } else if (response.url.includes('/login')) {448 location.href = "/account/login";449 } else {450 return response.json()451 }452 });453 }454}455export { tastingPostSubmitContents }456// 삭처리457export function postInfoPageFet(num, pages) {458 let tastingDeSumbit = document.getElementById("delCheckBtt")459 tastingDeSumbit.addEventListener('click', () => {460 infoPostDeCall()461 // 마페로감462 location.href = pages463 })464 function infoPostDeCall() {465 let url = '/api/v1/post/' + num466 fetch(url, {467 method: 'DELETE',468 headers: { 'Content-Type': 'application/json' },469 }).then(function (response) {470 if (!response.ok) {471 let error = response472 error.then(() => {473 location.href = pages474 })475 } else {476 formExpCheck(response)477 }478 });479 }480}481// 만료첵482function formExpCheck(e) {483 if (e.url.includes('/login')) {484 location.href = "/account/login"485 } else {486 return e.json()487 }488}489let postCon = ''490function postListWineTasting(page, id, link) {491 let url = '/api/v1/post/' + page + '/' + link + '/' + id492 fetch(url)493 .then(e => e.json())494 .then(json => {495 const tableBodyEl = document.getElementById("userTastingTableBody")496 const tableTrEl = document.createElement("tr")497 if (json.totalElements != 0) {498 removeAllchild(tableBodyEl)499 for (let i = 0; i < json.content.length; i++) {500 let numberCount = ((json.totalElements - (json.pageable.pageNumber * 5)) - (i))501 tableTrEl.innerHTML = `502 <td>503 <div class="row justify-content-md-center align-self-center">504 <div class="row">505 <b class="col-md-2"><i class="fa-solid fa-book me-1"></i>`+ numberCount + `</b>506 <span class="col-md-6 font-bold mb-0">`+ (json.content[i].title.slice(0, 40)) + (json.content[i].title.length > 40 ? '...' : '') + `</span>507 <div class="col-md-4">508 <div class="row">509 <span class="col-7 mb-0">`+ json.content[i].userId + `</span>510 <span class="col-5 text-center mb-0">`+ json.content[i].modifieDate + `</span>511 </div>512 </div>513 </div>514 </div>515 </td>516 `517 // 번호 등록518 tableTrEl.setAttribute('data-columnNum', json.content[i].postId)519 // 공동520 tableBodyEl.appendChild(tableTrEl.cloneNode(true));521 }522 // 컨텐츠 이동523 tableBodyEl.querySelectorAll('tr[data-columnNum]').forEach(e => { // 공통524 e.addEventListener('click', () => {525 location.href = "/post/info/" + e.dataset.columnnum + "/" + (postCon == '' ? json.pageable.pageNumber + 1 : postCon)526 })527 })528 pageNavDataSet('wineInfoPagelistNavBar', postListWineTasting, id, json, link)529 } else {530 createNoneMessageAllchild(document.getElementById("headTasting"), tableTrEl, tableBodyEl, `<div class="mt-4"><b>등록된 테이스팅 노트가 없습니다.</b></div>`)531 }532 });533}534// 마이 포스팅535function postListMyTasting(num) {536 let url = '/api/v1/account/post/wine/' + num537 fetch(url)538 .then(e => formExpCheck(e))539 .then(json => {540 const tastingDivEl = document.getElementById("mytastingDiv")541 const tastingDivCard = document.createElement("div")542 const tastingMessageDiv = document.getElementById("sectiontastingMassage")543 if (json.totalElements != 0) {544 tastingDivCard.setAttribute("class", "card box-shadow mx-1 my-3 text-center")545 tastingDivCard.setAttribute("style", "width: 9em; height: 12em;")546 tastingDivCard.setAttribute("data-bs-toggle", "modal")547 tastingDivCard.setAttribute("data-bs-target", "#itemBoardModalList")548 removeAllchild(tastingDivEl)549 if (tastingMessageDiv != null) {550 tastingMessageDiv.remove()551 }552 for (let i = 0; i < json.numberOfElements; i++) {553 tastingDivCard.innerHTML = `554 <img src="`+ json.content[i].wineImageUrl + `" class="card-img-top" alt="...">555 <p class="card-text mt-3 py-2 h6 small">`+ (json.content[i].displayNameKo.substring(0, 20)) + (json.content[i].displayNameKo.length > 20 ? '...' : '') + `</p>556 `557 // 번호558 tastingDivCard.setAttribute("data-columnNum", json.content[i].wineId)559 // 공동560 tastingDivEl.appendChild(tastingDivCard.cloneNode(true));561 }562 // 컨텐츠 이동563 tastingDivEl.querySelectorAll('div[data-columnNum]').forEach(e => { // 공통564 e.addEventListener('click', () => {565 postListWineTasting(1, e.dataset.columnnum, 'wine')566 document.getElementById('postCreatBtt').href = "/post/" + e.dataset.columnnum567 postCon = (json.pageable.pageNumber + 1)568 })569 })570 pageNavDataSet('tastingPageList', postListMyTasting, 0, json)571 } else {572 createNoneMessageAllchild(document.getElementById("topContentBody"), tastingDivCard, document.getElementById("testingMassage"), `<b>지금 바로 포스팅을 작성해보세요!.</b>`)573 }574 })575}576export { postListWineTasting, postListMyTasting }577// 코멘 정보578export function postCommentSubmit(id, coid, methods, data, commentInputId) {579 const commentInput = commentInputId580 if (commentInput.value.length >= 15) {581 let url = '/api/v1/comment'582 fetch(url, {583 method: methods,584 headers: { 'Content-Type': 'application/json' },585 body: JSON.stringify({586 commentId: coid,587 comment: commentInput.value,588 postId: id589 }),590 }).then(function (response) {591 if (!response.ok) {592 document.getElementById('postModalBtt').click()593 } else if (response.url.includes('/login')) {594 location.href = "/account/login";595 } else {596 postCommentList(1, id, data)597 commentInput.value = ''598 }599 });600 } else {601 alert('15자리 이상 입력해주세요.')602 }603}604// 코멘 리스트605let commentDelId = ''606let commentEditId = ''607let commentPre = ''608let thisCommentCountNum = 1609export function postCommentList(page, item, data) {610 // 삭611 function infoCommentDeCall(num) {612 let url = '/api/v1/comment/' + num613 fetch(url, {614 method: 'DELETE',615 }).then(function (response) {616 if (!response.ok) {617 let error = response618 error.then(() => {619 })620 } else {621 con = true622 postCommentList(thisCommentCountNum, item, data)623 }624 });625 }626 // 버튼컨트롤627 function commitBttCreate(e) {628 e.parentElement.querySelectorAll('button').forEach(btt => {629 if (btt.classList.contains('d-none')) {630 btt.classList.remove('d-none')631 } else {632 btt.classList.add('d-none')633 }634 })635 }636 // 셀렉트 컨637 function selectForClick(body, selected, bool) {638 body.querySelectorAll(selected).forEach(e => {639 e.addEventListener('click', () => {640 if (bool) {641 commentEditId.setAttribute('readonly', 'true')642 commentEditId.classList.remove('border', 'border-2')643 commentEditId.value = commentPre644 } else {645 commentEditId.removeAttribute("readonly")646 commentEditId.classList.add('border', 'border-2')647 }648 commitBttCreate(e)649 })650 })651 }652 let url = '/api/v1/comment/' + item + '/' + page653 fetch(url)654 .then(e => e.json())655 .then(json => {656 const tableBodyEl = document.getElementById("userTastingTableBody")657 const tableTrEl = document.createElement("tr")658 if (json.totalElements != 0) {659 removeAllchild(tableBodyEl)660 for (let i = 0; i < json.content.length; i++) {661 let numberCount = ((json.totalElements - (json.pageable.pageNumber * 5)) - (i))662 let editBtt = function () {663 if (data == json.content[i].num) {664 return `<div class="row-auto bg-white">665 <div class="row justify-content-center">666 <button class="col-auto btn btn-sm btn-outline-secondary" data-button-type="edit"><i class="fa-solid fa-pen"></i>edit</button>667 <button class="col-auto btn btn-sm btn-outline-secondary d-none" data-button-type="modify"><i class="fa-solid fa-check"></i></i>modify</button>668 <button class="col-auto btn btn-sm btn-outline-secondary d-none" data-button-type="cancel"><i class="fa-solid fa-xmark"></i>cancel</button>669 <button class="col-auto btn btn-sm btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#delCommentModalCenter"><i class="fa-solid fa-eraser"></i>del</button>670 </div>671 </div>`672 }673 return ''674 }675 tableTrEl.innerHTML = `676 <td class="p-0">677 <div class="row-auto ps-3 py-2 border-bottom justify-content-center align-self-center" data-bs-toggle="collapse" data-bs-target="#collapseOne`+ i + `" aria-expanded="true" aria-controls="collapseOne` + i + `" id="heading` + i + `">678 <div class="row">679 <b class="col-md-2"><i class="fa-solid fa-book me-1"></i>`+ numberCount + `</b>680 <span class="col-md-5 font-bold mb-0">`+ (json.content[i].comment.slice(0, 20)) + (json.content[i].comment.length > 20 ? '...' : '') + `</span>681 <div class="col-md-5">682 <div class="row">683 <span class="col-5 mb-0">`+ json.content[i].userId + `</span>684 <span class="col-7 text-center mb-0">`+ json.content[i].createDate + `</span>685 </div>686 </div>687 </div>688 </div>689 <div id="collapseOne`+ i + `" class="accordion-collapse bg-white collapse" aria-labelledby="heading` + i + `" data-bs-parent="#accordion">690 <div class="row-auto">691 <div class="col-md-12">692 <textarea class="comment outcontent px-3 py-2" data-button-type="textarea"693 placeholder="최소 15자리 이상 입력" rows="4" style="resize : none;" readonly>`+ json.content[i].comment + `</textarea>694 <span class="d-none" data-button-type="textareare">`+ json.content[i].comment + `</span>695 </div>696 `+ editBtt() + `697 </div>698 </div>699 </td>700 `701 // 번호702 tableTrEl.setAttribute("data-commentNum", json.content[i].commentId)703 // 공동704 tableBodyEl.appendChild(tableTrEl.cloneNode(true));705 }706 tableBodyEl.querySelectorAll('tr[data-commentNum]').forEach(e => {707 e.addEventListener('click', () => {708 commentDelId = e.dataset.commentnum709 commentEditId = e.querySelector('textarea')710 commentPre = e.querySelector('span[data-button-type="textareare"]').innerText711 })712 })713 tableBodyEl.querySelectorAll('button[data-button-type="modify"]').forEach(e => {714 e.addEventListener('click', () => {715 postCommentSubmit(item, commentDelId, 'PUT', data, commentEditId)716 })717 })718 selectForClick(tableBodyEl, 'button[data-button-type="edit"]', false) // edit719 selectForClick(tableBodyEl, 'button[data-button-type="cancel"]', true) // cancel720 const commentDel = document.getElementById("delCommentCheckBtt").addEventListener('click', () => {721 if (con) {722 con = false723 infoCommentDeCall(commentDelId)724 }725 })726 pageNavDataSet('wineInfoPagelistNavBar', postCommentList, item, json, data)727 } else {728 removeAllchild(document.getElementById('wineInfoPagelistNavBar'))729 removeAllchild(tableBodyEl)730 const newTable = document.createElement("div")731 newTable.setAttribute('class', 'mt-4')732 createNoneMessageAllchild(document.getElementById("headTasting"), newTable, tableBodyEl, `<b>등록된 댓글이 없습니다.</b>`)733 }734 });735}736//------------------------------------------------------------------------------------------------737export function mainLinkedList() {738 const mainBestPost = document.getElementById('mainBestGallery')739 mainBestPost.querySelectorAll('div[data-postNum]').forEach(e => {740 e.addEventListener('click', () => {741 location.href = '/post/info/' + e.dataset.postnum + '/1'742 })743 })744}745export function noticeLinks() {746 const mainNoticeList = document.getElementById('noticeBoardList')747 mainNoticeList.querySelectorAll('tr[data-noticeNum]').forEach(e => {748 e.addEventListener('click', () => {749 setCookie("_vi", 1)750 location.href = '/notice/' + e.dataset.noticenum751 })752 })753}754export function noticeFun(page) {755 noticeListWineTasting(page)756 function noticeListWineTasting(page) {757 let url = '/api/v1/notice/' + page758 fetch(url)759 .then(e => e.json())760 .then(json => {761 const tableBodyEl = document.getElementById("noticeBoardList")762 const tableTrEl = document.createElement("tr")763 if (json.totalElements != 0) {764 removeAllchild(tableBodyEl)765 for (let i = 0; i < json.content.length; i++) {766 let numberCount = ((json.totalElements - (json.pageable.pageNumber * 10)) - (i))767 tableTrEl.innerHTML = `768 <td data->769 <div class="row justify-content-md-center align-self-center">770 <b class="col-md-2"><i class="fa-solid fa-book me-1"></i>`+ numberCount + `</b>771 <span class="col-md-8 font-bold mb-0">`+ (json.content[i].noticeTitle.slice(0, 40)) + (json.content[i].noticeTitle.length > 40 ? '...' : '') + `</span>772 <span class="col-auto text-center mb-0">`+ json.content[i].modifieDate + `</span>773 </div>774 </td>775 `776 // 번호 등록777 tableTrEl.setAttribute('data-noticenum', json.content[i].noticeId)778 // 공동779 tableBodyEl.appendChild(tableTrEl.cloneNode(true));780 }781 // 컨텐츠 이동782 tableBodyEl.querySelectorAll('tr[data-noticenum]').forEach(e => { // 공통783 e.addEventListener('click', () => {784 location.href = '/notice/' + e.dataset.noticenum785 setCookie("_vi", json.pageable.pageNumber+1)786 })787 })788 pageNavDataSet('noticePagelistNavBar', noticeListWineTasting, 0, json)789 } else {790 createNoneMessageAllchild(document.getElementById("headTasting"), tableTrEl, tableBodyEl, `<div class="mt-4"><b>등록된 테이스팅 노트가 없습니다.</b></div>`)791 }792 });793 }794}795export function noticePostSet(){796 const Editor = toastui.Editor;797 const editor = new Editor({798 el: document.querySelector('#editor'),799 height: '500px',800 initialEditType: 'wysiwyg',801 previewStyle: 'vertical',802 hooks: {803 addImageBlobHook: (blob, callback) => {804 const upload = blob805 noticePhotoUpload(blob).then(e=> { callback(e,"alt")806 console.log(e.url)})807 }808 }809 });810 async function noticePhotoUpload(blob) {811 let url = '/api/v1/notice/image/upload'812 const formData = new FormData();813 formData.append("multipartFiles", blob);814 return await fetch(url, {815 method: 'POST',816 body: formData817 }).then(function (response) {818 if (response.ok) {819 return response.text()820 } else if (response.url.includes('/login')) {821 location.href = "/account/login";822 }823 });824 }825 document.getElementById('noticePostSubmit').addEventListener('click', () => {826 const title = document.getElementById('noticeTitle')827 let url = '/api/v1/notice/post'828 fetch(url, {829 method: 'POST',830 headers: { 'Content-Type': 'application/json' },831 body: JSON.stringify({832 noticeTitle : title.value,833 noticeContents : editor.getHTML()834 })835 }).then(function (response) {836 if (response.ok) {837 response.text().then(e=>{838 location.href = "/notice/" + e839 })840 } else if (response.url.includes('/login')) {841 location.href = "/account/login";842 }843 });844 })...

Full Screen

Full Screen

Span.service.ts

Source:Span.service.ts Github

copy

Full Screen

...34 ''35 ) || ''36 ).trim()}]`;37 },38 searchSpanList(spanList: TSpan[], searchText: string) {39 if (!searchText.trim()) return [];40 return spanList.reduce<string[]>(41 (matchList, span) => (getObjectIncludesText(span.attributes, searchText) ? [...matchList, span.id] : matchList),42 []43 );44 },45});...

Full Screen

Full Screen

Span.service.test.ts

Source:Span.service.test.ts Github

copy

Full Screen

...26 });27 describe('getSelectorInformation', () => {28 it('should return the spanList', () => {29 const span = SpanMock.model();30 const selectorInfo = SpanService.searchSpanList([span], 'tracetest');31 expect(selectorInfo).toHaveLength(1);32 });33 });34 describe('getSelectorInformation', () => {35 it('should return the selector information', () => {36 const span = SpanMock.model();37 const selector = SpanService.getSelectorInformation(span);38 expect(typeof selector === 'string').toBeTruthy();39 });40 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var searchSpanList = tracetest.searchSpanList;3 { traceId: '123', spanId: '1', parentSpanId: '0', serviceName: 'service1', operationName: 'op1', startTime: 100, duration: 100 },4 { traceId: '123', spanId: '2', parentSpanId: '1', serviceName: 'service2', operationName: 'op2', startTime: 200, duration: 100 },5 { traceId: '123', spanId: '3', parentSpanId: '1', serviceName: 'service3', operationName: 'op3', startTime: 300, duration: 100 },6 { traceId: '123', spanId: '4', parentSpanId: '3', serviceName: 'service4', operationName: 'op4', startTime: 400, duration: 100 },7 { traceId: '123', spanId: '5', parentSpanId: '4', serviceName: 'service5', operationName: 'op5', startTime: 500, duration: 100 },8 { traceId: '123', spanId: '6', parentSpanId: '6', serviceName: 'service6', operationName: 'op6', startTime: 600, duration: 100 },9];10var result = searchSpanList(spanList, 'service4', 'op4');11console.log(result);12var tracetest = require('tracetest');13var searchSpanList = tracetest.searchSpanList;14 { traceId: '123', spanId: '1', parentSpanId: '0', serviceName: 'service1', operationName: 'op1', startTime: 100, duration: 100 },15 { traceId: '123', spanId: '2', parentSpanId: '1', serviceName: 'service2', operationName: 'op2', startTime: 200, duration: 100 },16 { traceId: '123', spanId: '3', parentSpanId: '1', serviceName: 'service3', operationName: 'op3', startTime: 300, duration: 100 },17 { traceId: '

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetesting = require('./tracetesting.js');2var spanList = tracetesting.searchSpanList('spanName', 'spanValue');3console.log(spanList);4var trace = require('@google-cloud/trace-agent').get();5var searchSpanList = function(spanName, spanValue) {6 var spanList = trace.getSpanList();7 var spanResult = [];8 for (var i = 0; i < spanList.length; i++) {9 var span = spanList[i];10 if (span.labels[spanName] == spanValue) {11 spanResult.push(span);12 }13 }14 return spanResult;15};16exports.searchSpanList = searchSpanList;17exports.searchSpanList = searchSpanList;18module.exports = searchSpanList;19{ [Error: Cannot find module './tracetesting.js'] code: 'MODULE_NOT_FOUND' }

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('./tracetest.js');2var spanList = tracetest.searchSpanList("message");3console.log(spanList);4var tracetest = require('./tracetest.js');5var spanList = tracetest.searchSpanList("message");6console.log(spanList);7[ { traceId: '7a3c60f8b6e3eef7799d59f2b379b259',8 [ { key: 'sampler.type',9 vLong: 0 },10 { key: 'sampler.param',11 vLong: 0 },12 { key: 'span.kind',13 vLong: 0 } ],14 logs: [] },15 { traceId: '7a3c60f8b6e3eef7799d59f2b379b259',16 [ { key: 'sampler.type',17 vLong: 0 },18 { key: 'sampler.param',

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var spanList = tracetest.searchSpanList('test', 1000, 2000, 'spanKind');3console.log(spanList);4var tracetest = {};5 {6 }7];8tracetest.searchSpanList = function(name, startTime, endTime, spanKind) {9 return spanList;10};11module.exports = tracetest;

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var spanList = tracetest.searchSpanList('test', 1000, 2000, 'spanKind');3console.log(spanList);4var tracetest = {};5 {6 }7];8tracetest.searchSpanList = function(name, startTime, endTime, spanKind) {9 return spanList;10};11module.exports = tracetest;

Full Screen

Using AI Code Generation

copy

Full Screen

1var trace = require('trace');2var searchSpanList = trace.searchSpanList;3searchSpanList(function(span) {4 console.log('span: ' + span);5});6var trace = require('trace');7var searchSpanList = trace.searchSpanList;8var searchSpanList = trace.searchSpanList;9searchSpanList(function(span) {10 console.log('span: ' + span);11});12var trace = require('trace');13var searchSpanList = trace.searchSpanList;14var searchSpanList = trace.searchSpanList;15searchSpanList(function(span) {16 console.log('span: ' + span);17});18var trace = require('trace');19var searchSpanList = trace.searchSpanList;20var searchSpanList = trace.searchSpanList;21searchSpanList(function(span) {22 console.log('span: ' + span);23});

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var spanList = tracetest.getSpanList();3var span = tracetest.searchSpanList(spanList, 'spanName');4var spanInfo = {startTime: span.getStartTime(), endTime: span.getEndTime()};5console.log(JSON.stringify(spanInfo));6{ "startTime": 1464201260000, "endTime": 1464201260000 }7{ "startTime": 0, "endTime": 0 }8{ "startTime": 0, "endTime": 0 }9{ "startTime": 0, "endTime": 0 }10{ "startTime": 1464201260000, "endTime": 1464201260000 }11{ "startTime": 1464201260000, "endTime": 1464201260000 }12{ "startTime": 1464201260000, "endTime": 1464201260000 }13{ "startTime": 1464201260000, "endTime": 1464201260000 }14var trace = require('trace');15var searchSpanList = trace.searchSpanList;16var searchSpanList = trace.searchSpanList;17searchSpanList(function(span) {18 console.log('span: ' + span);19});20var trace = require('trace

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var spanList = tracetest.getSpanList();3var span = tracetest.searchSpanList(spanList, 'spanName');4var spanInfo = {startTime: span.getStartTime(), endTime: span.getEndTime()};5console.log(JSON.stringify(spanInfo));6{ "startTime": 1464201260000, "endTime": 1464201260000 }7{ "startTime": 0, "endTime": 0 }8{ "startTime": 0, "endTime": 0 }9{ "startTime": 0, "endTime": 0 }10{ "startTime": 1464201260000, "endTime": 1464201260000 }11{ "startTime": 1464201260000, "endTime": 1464201260000 }12{ "startTime": 1464201260000, "endTime": 1464201260000 }13{ "startTime": 1464201260000, "endTime": 1464201260000 }

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