1 parent
6aa89b77dc
commit
918b70185e
3 files changed
+60
No files matched your search
@@ -1359,6 +1359,7 @@ class Server(object):
|
||||
"js/lib/pnotify/pnotify.nonblock.min.js",
|
||||
"js/lib/pnotify/pnotify.reference.min.js",
|
||||
"js/lib/pnotify/pnotify.tooltip.min.js",
|
||||
"js/lib/pnotify/pnotify.maxheight.js",
|
||||
"js/lib/moment-with-locales.min.js",
|
||||
"js/lib/pusher.color.min.js",
|
||||
"js/lib/detectmobilebrowser.js",
|
||||
|
||||
@@ -194,6 +194,11 @@ $(function() {
|
||||
PNotify.prototype.options.delay = 5000;
|
||||
PNotify.prototype.options.animate_speed = "fast";
|
||||
|
||||
PNotify.prototype.options.maxheight.maxheight = function() {
|
||||
return $(window).height() - 170; // top margin + header + footer + some safety margin
|
||||
};
|
||||
|
||||
// single button notify
|
||||
PNotify.singleButtonNotify = function(options) {
|
||||
if (!options.confirm || !options.confirm.buttons || !options.confirm.buttons.length) {
|
||||
return new PNotify(options);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// Maxheight
|
||||
(function (factory) {
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
// CommonJS
|
||||
module.exports = factory(require('jquery'), require('pnotify'));
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as a module.
|
||||
define('pnotify.confirm', ['jquery', 'pnotify'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery, PNotify);
|
||||
}
|
||||
}(function($, PNotify){
|
||||
PNotify.prototype.options.maxheight = {
|
||||
// Maximum height of text area to enforce
|
||||
maxheight: false
|
||||
};
|
||||
|
||||
var _position = PNotify.prototype.position;
|
||||
PNotify.prototype.position = function(){
|
||||
if (typeof this.options.maxheight.maxheight === "function") {
|
||||
setMaxHeight(this, this.options.maxheight);
|
||||
}
|
||||
_position.apply(this, arguments);
|
||||
};
|
||||
|
||||
var setMaxHeight = function(notice, options) {
|
||||
if (!options.maxheight) return;
|
||||
|
||||
var option = options.maxheight;
|
||||
if (typeof option === "function") {
|
||||
option = option();
|
||||
}
|
||||
|
||||
var height;
|
||||
if (typeof option === "number") {
|
||||
// assuming pixels
|
||||
height = "" + option + "px";
|
||||
} else if (typeof option === "string") {
|
||||
// assuming css string
|
||||
height = option
|
||||
} else {
|
||||
// unknown, ignore
|
||||
return;
|
||||
}
|
||||
notice.text_container.css("max-height", height);
|
||||
notice.text_container.css("overflow", "auto");
|
||||
};
|
||||
|
||||
PNotify.prototype.modules.maxheight = {
|
||||
init: setMaxHeight,
|
||||
update: setMaxHeight
|
||||
};
|
||||
}));
|
||||
Reference in new issue
Block a user