This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let search = location.search.substring(1), urlParams; | |
urlParams = JSON.parse( | |
'{"' + search.replace(/&/g, '","').replace(/=/g, '":"') + '"}', | |
function (key, value) { | |
return key === "" ? value : decodeURIComponent(value); | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="div1 d-block"> | |
// div content | |
</div> | |
<div class="div2 d-none"> | |
// div content | |
</div> | |
<div class="div3 d-none"> | |
// div content | |
</div> | |
--------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkObject(data, columns) { | |
let obj = {}; | |
Object.entries(data).forEach((ele, i) => { | |
columns.forEach(col => { | |
if (ele[0] == col.field || ele[0] == 'id') { | |
obj[ele[0]] = ele[1]; | |
} | |
}); | |
}); | |
for (var key in obj) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setHeightTextarea () { | |
$("textarea") | |
.on("change keyup keydown paste cut", function () { | |
$(this).height(0).height(this.scrollHeight); | |
}) | |
.find("textarea") | |
.change(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example Output | |
* | |
* "id : PS10140" | |
* "sdid : SD13112" | |
* "disableCrud : false" | |
* "newQueryParameter : true" | |
*/ | |
var obj = {id: "PS10140", sdid: "SD13112", disableCrud: "false", newQueryParameter: "true"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param data - any datatype value. | |
*/ | |
function isEmpty(data) { | |
if (typeof data == "number" || typeof data == "boolean") return false; | |
if (typeof data == "undefined" || data === null) return true; | |
if (typeof data.length != "undefined") return data.length == 0; | |
let count = 0; | |
for (let i in data) if (data.hasOwnProperty(i)) count++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @param str: string without space | |
function reverseStr(str){ | |
return str.split('').reverse().join(''); | |
} | |
// @param sentence: pass a sentence. | |
function reverseEachWordInSentence(sentence){ | |
return sentence.split(' ').map(reverseStr).join(' '); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param arr: Array | |
* @param ele: element to be added | |
* @param remEle: element to be deleted | |
*/ | |
function addDelEleFromArray(arr = [], ele = "", remEle = "") { | |
if (ele && !arr.some((a) => a == ele)) arr.push(ele); | |
if (remEle) return arr.filter((a) => a != remEle); | |
return arr; | |
} |
OlderNewer