$("#search-submit").click(function() {
  $("#search form").submit()
});

type="submit" is too mainstream, jquery is the proper way to do it

By Kadet, 2016-02-13 16:44:10

var move=0;
var kier=0;
var pic=0;
var rol=0;

var rol2=171;
var rol3=343;
var rol4=514;
var rol2_cel=171;
var rol3_cel=343;
var rol4_cel=514;

function onpic(p) {
  pic=p;
}

function offpic(p) {
  if( pic==p ) pic=0;
}

 function next() { if(move<40) move = 40; kier=0; }
 function prev() { if(move<40) move = 60; kier=1; }
 function set() {
  document.getElementById('ba1').style.left=0;
  document.getElementById('ba2').style.left=rol2;
  document.getElementById('ba3').style.left=rol3;
  document.getElementById('ba4').style.left=rol4;
}


function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}


var randtim=new Array(110,103,130,125,108,118,112,122,101,100);
var showtimer=0;
var showpic=1;

 
 function Animuj() {
   if( pic==0 ) {
     rol2_cel=171;
     rol3_cel=343;
     rol4_cel=514;
   } else if( pic==1 ) {
     rol2_cel=342;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==2 ) {
     rol2_cel=115;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==3 ) {
     rol2_cel=114;
     rol3_cel=229;
     rol4_cel=571;
   } else if( pic==4 ) {
     rol2_cel=114;
     rol3_cel=228;
     rol4_cel=344;
   }
   var a = (rol2-rol2_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol2!=rol2_cel ) rol2-= a;
   var a = (rol3-rol3_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol3!=rol3_cel ) rol3-= a;
   var a = (rol4-rol4_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol4!=rol4_cel ) rol4-= a;
   set();
    document.getElementById('ba2').style.left=rol2;



 showtimer+=1;
 if(showtimer>100) {
  for( st=0; st<9; ++st ) {
   if(showtimer==randtim[st]) { SetOpacity(document.getElementById("ps"+st), 0); document.getElementById("ps"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; }
   if(showtimer==(randtim[st]+1)) SetOpacity(document.getElementById("ps"+st),20); 
   if(showtimer==(randtim[st]+2)) SetOpacity(document.getElementById("ps"+st),40); 
   if(showtimer==(randtim[st]+3)) SetOpacity(document.getElementById("ps"+st),60); 
   if(showtimer==(randtim[st]+4)) SetOpacity(document.getElementById("ps"+st),80); 
   if(showtimer==(randtim[st]+5)) { document.getElementById("pn"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; SetOpacity(document.getElementById("ps"+st),0); }
  }
  if(showtimer>150) {
   showtimer=0;
   for( st=0; st<9; ++st ) randtim[st]=Math.floor(Math.random()*26)+100;
   showpic+=1; if(showpic>2) showpic=0;
  }
 }


 }

 window.setInterval("Animuj()", 50);

This is how public money is spent in poland

By Anonymous, 2019-05-29 18:35:09
function isEmpty(value) {
    if (value === '') {
        return false;
    } else if (value === 0) {
        return false;
    } else if (value === null) {
        return false;
    } else if (value === undefined) {
        return false;
    } else {
        return true;
    }
    return true;
}

javascript empty value check

By mr.js, 2017-12-13 11:43:20
if(date.getFullYear() <= 2017) {
    if(date.getMonth() <= 11) {
        if(date.getDate() <= 26) {
            if(date.getHours() <= 23) {
                if(date.getMinutes() <= 59) {
                    if(date.getSeconds() <= 59) {
                        //Display popup before 2017-11-27
                    }
                }
            }
        }
    }
}

    
By Anonymous, 2017-12-12 14:14:55
    function changePassword() {
        if (isInputEmpty()) {
            $.ajax({
                type: 'POST',
                data: '...'
                url: '...',
                success: function (result) {
                    if (result.substring(0, 3) != "!!!") {
                        //success
                    } else {
                        //faliure
                    }
                },
                error: function () {
                    }
            });
        }
    }

And of course,in production, it always reported success and never changed the password, because of equally bad server code.

By You will be proud of our code!, 2017-12-15 11:30:02
let arr = []
if(arr[record.id]) {
    arr[record.id] = false
} else {
    arr[record.id] = false
}
this.setState({a: arr})
arr = []
By Anonymous, 2021-12-27 06:55:59
var i = 0

for (var n in array) { 
    i+=1
    // ...
}
By PureJavascript, 2023-02-11 11:08:33
else if result !== true && result === false { return result !== true }

should I keep this in our project or nah

By codelord, 2022-06-20 16:43:54
var lightBox_ReplaceSelectsWithSpans = function()
{
	var selects = document.getElementsByTagName('select');
	for (var i = 0; i < selects.length; i++) {
		var select = selects[i];
		if (select.clientWidth == 0 || select.clientHeight == 0 || 
			select.nextSibling == null || select.nextSibling.className == 'selectReplacement') {
			continue;
		}
			
		var span = document.createElement('span');
		// this would be "- 3", but for that appears to shift the block that contains the span 
		//   one pixel down; instead we tolerate the span being 1px shorter than the select
		span.style.height = (select.clientHeight - 4) + 'px';
		span.style.width = (select.clientWidth - 6) + 'px';
		span.style.display = 'inline-block';
		span.style.border = '1px solid rgb(200, 210, 230)';
		span.style.padding = '1px 0 0 4px';
		span.style.fontFamily = 'Arial';
		span.style.fontSize = 'smaller';
		span.style.position = 'relative';
		span.style.top = '1px';
		span.className = 'selectReplacement';
		
		span.innerHTML = select.options[select.selectedIndex].innerHTML ;//+ 
			//'<img src="custom_drop.gif" alt="drop down" style="position: absolute; right: 1px; top: 1px;" />';
		
		select.cachedDisplay = select.style.display;
		select.style.display = 'none';
		select.parentNode.insertBefore(span, select.nextSibling);
	}
};
By Anonymous, 2023-03-29 16:59:15
$('#userCheck').not(this).prop('checked', false);
By Anonymous, 2019-04-17 10:54:22
form = JSON.parse(JSON.stringify(this.mobilityDistanceForm.getRawValue()));
By tralaladidou, 2019-07-15 20:41:51
 public void updateCurrency() {
        LOGGER.info("Update currencies");
        var ok = false;

        try {
            getExchangeRatesMechanism(getExchangeRatesProcessor());
            ok = true;
        } catch (Exception exception) {
            LOGGER.error(exception.getMessage(), exception);
        }

        if (ok) {
            LOGGER.info("The currencies were updated successfully!");
        }
    }
By halogenUnit, 2022-09-29 13:31:58
> var x = 3;
> '5' + x - x
50
> '5' - x + x
5 // Because fuck math

JS is simply. Oh, wait...

By mademan, 2015-11-18 13:50:39
function urlREPLACER(dtTEXTVALUE){
    
    dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');
    
    return dtTEXTVALUE;
}
By I'm glad, 2019-02-16 13:10:54
// Method put on each input component to unregister
  // itself from the form
  detachFromForm: function detachFromForm(component) {
    var componentPos = this.inputs.indexOf(component);

    if (componentPos !== -1) {
      this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));
    }

    this.validateForm();
  },

oh boy

By Anonymous, 2017-12-21 10:48:00