3 * expand contract jquery script
6 * @link http://www.open-emr.org
7 * @author Ranganath Pathak <pathak@scrs1.org>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
15 $
( document
).ready(function() {
16 $
('.expand_contract').click(function() {
17 var elementTitle
= $
(this
).prop('title');
18 var contractTitle
= <?php
echo xlj('Click to Contract and set to henceforth open in Centered mode'); ?
>;
19 var expandTitle
= <?php
echo xlj('Click to Expand and set to henceforth open in Expanded mode'); ?
>;
20 var arrFiles
= <?php
echo json_encode($arr_files_php) ?
>;
22 if (elementTitle
== contractTitle
) {
23 elementTitle
= expandTitle
;
24 $
(this
).toggleClass('fa-expand fa-compress');
25 $
('.expandable').toggleClass('container container-fluid');
26 if ($
(arrFiles
).length
) {
27 $
.each(arrFiles
, function (index
, value
) {
28 $
.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
30 target
: arrFiles
[index
].trim(),
32 csrf_token_form
: <?php
echo js_escape(collectCsrfToken()); ?
>
37 } else if (elementTitle
== expandTitle
) {
38 elementTitle
= contractTitle
;
39 $
(this
).toggleClass('fa-compress fa-expand');
40 $
('.expandable').toggleClass('container-fluid container');
41 if ($
(arrFiles
).length
) {
42 $
.each(arrFiles
, function (index
, value
) {
43 $
.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
45 target
: arrFiles
[index
].trim(),
47 csrf_token_form
: <?php
echo js_escape(collectCsrfToken()); ?
>
53 $
(this
).prop('title', elementTitle
);