Skip to content

Instantly share code, notes, and snippets.

@ZachMoreno
Created November 21, 2014 23:53
Show Gist options
  • Save ZachMoreno/636d67381fce01717539 to your computer and use it in GitHub Desktop.
Save ZachMoreno/636d67381fce01717539 to your computer and use it in GitHub Desktop.
// forEach method, could be shipped as part of an Object Literal/Module
var forEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]); // passes back stuff we need
}
};
// language-toggle
var activateEnglish = function () {
var allSpnElements = document.querySelectorAll("[data-spanish]"), i;
forEach(allSpnElements, function(index, value) {
jQuery(value).html(jQuery(value).data("english"));
});
// location.reload();
// jQuery("#meeting-info h1.card-header").html(jQuery("#meeting-info h1.card-header").data("english"));
},
activateSpanish = function () {
var allSpnElements = document.querySelectorAll("[data-spanish]");
forEach(allSpnElements, function(index, value) {
jQuery(value).html(jQuery(value).data("spanish"));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment