Skip to content

Commit

Permalink
change line separator to \n
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed Jun 1, 2024
1 parent 9425713 commit 958840c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions js/viewportDetect.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
/*!
* viewportDetect Plugin
* v1.0 [jj 13Dec18]
*
* returns the current viewport ("xs", "sm", "md", or "lg")
* $.viewportDetect()
*
* create a callback function that is called whenever the viewport changes
* $.viewportDetect(function(currentViewport, previousViewport) { });
*/

$(document).ready(function () {
// create some unobtrusive dom that bootstrap will show and hide depending on its media queries
$("body").append("<div id=\"viewportDetect\"><div class=\"visible-xs\" data-viewport=\"xs\"></div><div class=\"visible-sm\" data-viewport=\"sm\"></div><div class=\"visible-md\" data-viewport=\"md\"></div><div class=\"visible-lg\" data-viewport=\"lg\"></div></div>");

/* examples
// simply log the current viewport size every two seconds
setInterval(function () {
console.log("interval: " + $.viewportDetect()); },
2000);
// a callback fn that gets called whenever the viewport changes
$.viewportDetect(function (vp, prevVp) {
console.log("onChange: " + prevVp + " -> " + vp);
});
*/
});

(function ($) {
var _currentViewport = "";

$.viewportDetect = function(onChange) {
if (arguments.length == 0) {
return $("#viewportDetect div:visible").data("viewport");
}

// onChange is a function we want to call whenever the viewport changes
$(window).resize(function () {
var viewport = $("#viewportDetect div:visible").data("viewport");
if (_currentViewport == "") _currentViewport = viewport; // the first change is not really a change at all

if (_currentViewport != viewport) {
var prevViewport = _currentViewport;
_currentViewport = viewport;
onChange(_currentViewport, prevViewport);
}
});
};

})(jQuery);
/*!
* viewportDetect Plugin
* v1.0 [jj 13Dec18]
*
* returns the current viewport ("xs", "sm", "md", or "lg")
* $.viewportDetect()
*
* create a callback function that is called whenever the viewport changes
* $.viewportDetect(function(currentViewport, previousViewport) { });
*/

$(document).ready(function () {
// create some unobtrusive dom that bootstrap will show and hide depending on its media queries
$("body").append("<div id=\"viewportDetect\"><div class=\"visible-xs\" data-viewport=\"xs\"></div><div class=\"visible-sm\" data-viewport=\"sm\"></div><div class=\"visible-md\" data-viewport=\"md\"></div><div class=\"visible-lg\" data-viewport=\"lg\"></div></div>");

/* examples
// simply log the current viewport size every two seconds
setInterval(function () {
console.log("interval: " + $.viewportDetect()); },
2000);
// a callback fn that gets called whenever the viewport changes
$.viewportDetect(function (vp, prevVp) {
console.log("onChange: " + prevVp + " -> " + vp);
});
*/
});

(function ($) {
var _currentViewport = "";

$.viewportDetect = function(onChange) {
if (arguments.length == 0) {
return $("#viewportDetect div:visible").data("viewport");
}

// onChange is a function we want to call whenever the viewport changes
$(window).resize(function () {
var viewport = $("#viewportDetect div:visible").data("viewport");
if (_currentViewport == "") _currentViewport = viewport; // the first change is not really a change at all

if (_currentViewport != viewport) {
var prevViewport = _currentViewport;
_currentViewport = viewport;
onChange(_currentViewport, prevViewport);
}
});
};

})(jQuery);
Binary file modified languages/de_DE/LC_MESSAGES/messages.mo
Binary file not shown.
Binary file modified languages/en_US/LC_MESSAGES/messages.mo
Binary file not shown.
Binary file modified languages/sk_SK/LC_MESSAGES/messages.mo
Binary file not shown.

0 comments on commit 958840c

Please sign in to comment.