Skip to content

Instantly share code, notes, and snippets.

Avatar

Shyam Kansagra shyamvkansagra

View GitHub Profile
View Custom platform implementation
<script type="text/javascript" src="YOUR_SCRIPT_URL"></script>
<script type="text/javascript">
var swymJSObject = {
pid: "YOUR_PID_VALUE"
};
window.swymJSCCLoad = function(){
if(!window._swat) {
console.log("swymJSCCLoad", "if");
(function (s, w, r, e, l, a, y) {
@shyamvkansagra
shyamvkansagra / Javascript_equivalents_for_jQuery.md
Last active Oct 18, 2021
This document lists some easy to use utility type functions when you want to replace jQuery with javascript. Also it describes few commonly used selectors and their equivalent javascript code.
View Javascript_equivalents_for_jQuery.md

Here I have listed jQuery selectors, their meanings and their equivalent javascript code to replace. Also, when code gets repetitive, I had created some util functions too which we can simply call and use.

Check out util functions: To create some for your code, you can create a global variable (if needed) and add our custom methods in it. This saves repetition of the code and feels like you are writing a library functions which can be used from anywhere.

window.Utils = {}

Utils.insertBefore = function(elemStrToAttach, insertPlaceElem) {
  var elemToInsert = SwymUtils.createElement(elemStrToAttach);