/*
* phpMyEdit - instant MySQL table editor and code generator
*
* phpMyEdit.js - runtime javascript part of phpMyEdit
* ___________________________________________________
*
* Copyright (c) 1999-2002 John McCreesh <jpmcc@users.sourceforge.net>
* Copyright (c) 2001-2002 Jim Kraai <jkraai@users.sourceforge.net>
* Versions 5.0 and higher developed by Ondrej Jombik <nepto@php.net>
* Versions 5.7.2 and higher developed by Yves De Billoëz
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README.md file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* https://sourceforge.net/projects/phpmariaedit/
*/
/* $Platon: phpMyEdit/js/phpMyEdit.js,v 5.7.6 2024-01-15 12:57:07 Yves $ */
function PME_js_trim(str)
{
while (str.substring(0, 1) == " "
|| str.substring(0, 1) == "\n"
|| str.substring(0, 1) == "\r")
{
str = str.substring(1, str.length);
}
while (str.substring(str.length - 1, str.length) == " "
|| str.substring(str.length - 1, str.length) == "\n"
|| str.substring(str.length - 1, str.length) == "\r")
{
str = str.substring(0, str.length - 1);
}
return str;
}
function PME_js_filter_handler(theForm, theEvent)
{
var pressed_key = null;
if (theEvent.which) {
pressed_key = theEvent.which;
} else {
pressed_key = theEvent.keyCode;
}
if (pressed_key == 13) { // enter pressed
theForm.submit();
return false;
}
return true;
}
function PME_js_form_control(theForm, e) {
//console.log(theForm); // DEBUG
//console.log(e); // DEBUG
}
function PME_js_show_tab(theTab) {
//console.log(theTab); // DEBUG
}
/* function called to confirm deletion of record
*/
function PME_js_confirm(msg, e) {
//console.log(e); // DEBUG
return confirm(msg);
}
/* function called to show alert dialog
*/
function PME_js_alert(msg, e) {
//console.log(e); // DEBUG
return alert(msg);
}
/* function called before phpMyEdit main starting call
*/
function PME_js_init(phpOpts) {
PME_js_setPageTitle(phpOpts.tb);
//console.log(phpOpts); // DEBUG
}
/* set page title
*/
function PME_js_setPageTitle(pageTitle, pageTitleLink) {
/* remove leading pme_ from possible pageTitle */
if (pageTitle.toLowerCase().indexOf("pme_") == 0) pageTitle = pageTitle.substring(4);
document.title = pageTitle.charAt(0).toUpperCase() + pageTitle.substring(1);
let el = document.getElementById('PME-pagetitle');
if (el != null) {
if (el.hasAttribute('data-caption')) {
el.setAttribute('data-caption', document.title);
} else {
if (typeof pageTitleLink === 'undefined') {
el.innerHTML = document.title;
} else {
el.innerHTML = "<a href='" + pageTitleLink + "'>" + document.title + "</a>";
}
}
}
}
/* eof */