mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
Update convert-template Add basic page Add it to the sidebar Fix a broken link Fix translate usage and add linebreaks Fix indents Add basic sidebar Port over init button logic Migrate submit_and_notify and start dest addr Get the payment button working Componentize the Send XRP Payment button Add basic escrow button Componentize payment channel Migrate Trust For Migrate Send Issued Currency Add partial payment progres bar logic Use the component for the partial payment Add support for escrow finish Log transactions in sidebar Debugging partial payment setup Add support for changing destinationAddress Finish adding bootstrap growl notifications Use 'client' instead of 'api' Move DestinationAddressInput to component and remove ids Split the page into separate files Remove the old files for this page Update links Add space Add comment deprecating bootstrap-growl jquery Fix typing errors PR Comments Pt 1 Small PR fixes Encapsulate isValidDestinationAddress
107 lines
3.3 KiB
JavaScript
107 lines
3.3 KiB
JavaScript
/*
|
|
The MIT License
|
|
|
|
Copyright (c) Nick Larson, http://github.com/ifightcrime
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
*/
|
|
|
|
/**
|
|
* Replaced by react-alert after the Redocly migration.
|
|
* Please see tx-sender.page.tsx for an example of react-alerts in action.
|
|
*/
|
|
|
|
(function() {
|
|
var $;
|
|
|
|
$ = jQuery;
|
|
|
|
$.bootstrapGrowl = function(message, options) {
|
|
var $alert, css, offsetAmount;
|
|
options = $.extend({}, $.bootstrapGrowl.default_options, options);
|
|
$alert = $("<div>");
|
|
$alert.attr("class", "bootstrap-growl alert");
|
|
if (options.type) {
|
|
$alert.addClass("alert-" + options.type);
|
|
}
|
|
if (options.allow_dismiss) {
|
|
$alert.addClass("alert-dismissible");
|
|
$alert.append("<button class=\"close\" data-dismiss=\"alert\" type=\"button\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>");
|
|
}
|
|
$alert.append(message);
|
|
if (options.top_offset) {
|
|
options.offset = {
|
|
from: "top",
|
|
amount: options.top_offset
|
|
};
|
|
}
|
|
offsetAmount = options.offset.amount;
|
|
$(".bootstrap-growl").each(function() {
|
|
return offsetAmount = Math.max(offsetAmount, parseInt($(this).css(options.offset.from)) + $(this).outerHeight() + options.stackup_spacing);
|
|
});
|
|
css = {
|
|
"position": (options.ele === "body" ? "fixed" : "absolute"),
|
|
"margin": 0,
|
|
"z-index": "9999",
|
|
"display": "none"
|
|
};
|
|
css[options.offset.from] = offsetAmount + "px";
|
|
$alert.css(css);
|
|
if (options.width !== "auto") {
|
|
$alert.css("width", options.width + "px");
|
|
}
|
|
$(options.ele).append($alert);
|
|
switch (options.align) {
|
|
case "center":
|
|
$alert.css({
|
|
"left": "50%",
|
|
"margin-left": "-" + ($alert.outerWidth() / 2) + "px"
|
|
});
|
|
break;
|
|
case "left":
|
|
$alert.css("left", "20px");
|
|
break;
|
|
default:
|
|
$alert.css("right", "20px");
|
|
}
|
|
$alert.fadeIn();
|
|
if (options.delay > 0) {
|
|
$alert.delay(options.delay).fadeOut(function() {
|
|
return $(this).alert("close");
|
|
});
|
|
}
|
|
return $alert;
|
|
};
|
|
|
|
$.bootstrapGrowl.default_options = {
|
|
ele: "body",
|
|
type: "info",
|
|
offset: {
|
|
from: "top",
|
|
amount: 20
|
|
},
|
|
align: "right",
|
|
width: 250,
|
|
delay: 4000,
|
|
allow_dismiss: true,
|
|
stackup_spacing: 10
|
|
};
|
|
|
|
}).call(this);
|