Search This Blog

Tuesday, March 8, 2022

ES6 - compare two array of object

const remainItems = this.allImages.filter(v => this.loadedImagesArray.every(c => c.idx != v.idx));

Monday, March 27, 2017

Find different between start date and current date in Local Storage using Javascript

Find different between start date and current date in Local Storage using Javascript 



if (localStorage.getItem('bookname_1') == null) {
  var coeff = 1000 * 60 * 5;
var date = new Date();  //or use any other date
var rounded = new Date(Math.round(date.getTime() / coeff) * coeff)
console.log(rounded)
localStorage.setItem('bookname_1' , rounded);

}else{
var regDate=localStorage.getItem('bookname_1')
regDate=new Date(regDate)
   var now = new Date();
var one_day=1000*60*60*24;
var diffDays = Math.round(Math.abs((now.getTime() - regDate.getTime())/(one_day)));
alert(diffDays)
if(diffDays>=2){// change days here
document.getElementById('black').style.display = 'block';
}
}

Tuesday, October 13, 2015

Jquery Compare two array

var array1 = [1, 2, 3, 4, 5, 6];
var array2 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var diff = [];
var same=[];

jQuery.grep(array2, function(el) {
    if (jQuery.inArray(el, array1) == -1) diff.push(el);
 if (jQuery.inArray(el, array1) != -1) same.push(el);

});


alert(" the difference is " + diff+"same is "+same);



Compare Two array are same

var array1 = [4,8,9,10];
var array2 = [4,8,9,10];

var is_same = array1.length == array2.length && array1.every(function(element, index) {
    return element === array2[index];
});

console.log(is_same);


for(j=0;j<final_ans.length;j++){
if(get_ans[j] != final_ans[j]){
console.log(get_ans[j]+'  ------------------not equal---+'+ "#" + get_ans_id[j]+"li div" +'----------  '+final_ans[j] )
$("#" + get_ans_id[j]+" li div").addClass("wrong");
$("#" + get_ans_id[j]+" li div").css("display", "block");
}
else{
            // $('#msg').val('')
console.log(get_ans[j]+'  ---------------equal----------------  '+final_ans[j] )
$("#" + get_ans_id[j]+" li div").addClass("correct");
$("#" + get_ans_id[j]+" li div").css("display", "block");
}
}

Wednesday, July 15, 2015

Passing Scores from Flash Games to LMS & CMS




http://elearningbrothers.com/passing-scores-from-flash-games-to-lectora/


http://pipwerks.com/


https://code.google.com/p/swf-activity-module/w/list

Friday, January 16, 2015

HTML5 Misc




Types of Layout in HTML5

  • Fixed websites have a set width and resizing the browser or viewing it on different devices won’t affect on the way the website looks.
  • Fluid websites are built using percentages for widths. As a result, columns are relative to one another and the browser allowing it to scale up and down fluidly.

  • Adaptive websites introduce media queries to target specific device sizes, like smaller monitors, tablets, and mobile.

  • Responsive websites are built on a fluid grid and use media queries to control the design and its content as it scales down or up with the browser or device. 


Hide HTML5 video 'Controls' for Browser and iPad


<video id="video" controls src="video.mp4" poster="image.jpg" preload="auto" onplaying="this.controls=false"/></video>



HitTest on Transparent PNG Jquery plugin



This plugin allow to test dom objects collision and coordinates hitTest.The collision detection works on mobile and on desktop. It manage image and canvas transparency on rencent web browsers. The transparency is manage on canvas elements compatible web browsers.(on old web browsers, the tests are done on rectangular areas)
http://e-smartdev.com/en/#!jsPluginList/hittestJQuery

Tuesday, May 27, 2014

Front-End Development Frameworks

1. Bootstrap
http://getbootstrap.com/
(http://bootsnipp.com/resources)

2. Fbootstrapp
http://ckrack.github.io/fbootstrapp/

3. BootMetro
http://aozora.github.io/bootmetro/

4. Kickstrap
http://getkickstrap.com/

5. Foundation
http://foundation.zurb.com/

6. GroundworkCSS
http://groundworkcss.github.io/

7. Gumby
http://gumbyframework.com/

8. HTML KickStart
http://www.99lime.com/

9. IVORY
http://weice.in/ivory/

10. Kube
http://imperavi.com/kube/