PageSourceSearch

https://pahang.gov.my/index.php/ajax/init_js/init.js

js pahang.gov.my collected 2026-09-24 09:29:34 UTC 5,506 bytes, 168 lines download raw bytes

1
2
3
4// The rootPath is in many EPMS javascrips and ckeditor/config.js->config.baseHref
5//var rootPath = 'https://www.pahang.gov.my/';
6var rootPath = 'https://pahang.gov.my/'; // Modified by George on 20210627 to use FQDN for ajax call
7var indexPage = 'index.php'; // Used by admin.js->get_segment() and internal_link.js
8var indexPath = rootPath+'index.php/';
9var loggedId = '';
10var loggedGuid = '';
11var editorMode = 'ckeditor';
12var themeName = 'admin';
13var is_fixed_viewport = false;
14/*
15 * Added by Raj on 20210618
16 * Description: Chat settings and user information
17 * Require: architect-ui
18 * Usage: chat and chat firebase modules
19 */
20var loggedUsername = '';
21var loggedDisplayName = '';
22var gfb_cfg = [];
23var fcm_pk = '';
24/*--End -- */
25
26var gs_browser_status = '';
27var gn_break_point = 0;
28
29function base_url(){
30	return rootPath;
31}
32
33function root_url() {
34	return 'https://pahang.gov.my/';
35}
36
37function index_path(){
38 return indexPath;
39}
40
41function site_url(url){
42
43	return indexPath+url;
44}
45
46function assets_path(path){
47	return rootPath+'assets/'+path;
48}
49
50function get_logged_id(){
51	return loggedId;
52}
53
54function get_logged_guid(){
55	return loggedGuid;
56}
57
58/*
59 * Added by George on 20210526
60 * Description: Open right slide panel
61 * Require: architect-ui
62 * Usage: <a href="/index.php/system" onClick="slide_panel_open(this)">...</a>
63 */
64function slide_panel(e, title, width)
65{
66	//alert(e.href);
67
68	// See https://stackoverflow.com/questions/3655627/jquery-append-object-remove-it-with-delay
69	$(`<div class="app-drawer-wrapper">
70		<div class="drawer-nav-btn">
71			<button type="button" class="hamburger hamburger--elastic is-active" onClick="$(this).close_slide_panel()">
72			    <span class="hamburger-box"><span class="hamburger-inner"></span></span>
73			</button>
74		</div>
75		<div class="drawer-content-wrapper">
76			<iframe class="slide-iframe" src="${e.href}" style="border:none;position:absolute;width:100%;height:100%"></iframe>
77		</div>
78	   </div>
79	   <div class="app-drawer-overlay d-none animated fadeIn">
80		<style>
81		/* place the <script> inside div so that it can be removed together with div */
82		.app-drawer-wrapper { /* set the slide panel to 90% width */
83		    width: 90%;
84		    right: -90%;
85		}
86		.drawer-nav-btn { /* set the "X" button to the bottom left */
87		    top: initial; /* disable "top" atrribute. See https://www.geeksforgeeks.org/how-to-remove-css-top-and-left-attribute-with-jquery/ */
88		    right: 100%;
89		    bottom: 0px;
90		}
91		</style>
92		<script>
93 		    /* define jquery function to close the right slide panel */
94		    $.fn.close_slide_panel = function() {
95			// You can either hide the "X" button or animate it :)
96			//$(".drawer-nav-btn").hide(); // hide the "X" button
97			$(".hamburger").toggleClass("is-active"); // trans. effect
98
99			$(".app-drawer-wrapper").removeClass("drawer-open");
100			$(".app-drawer-overlay").addClass("d-none");
101
102			/* wait for animation to complete then remove the class */
103			setTimeout(function() {
104				$(".app-drawer-wrapper").remove();
105				$(".app-drawer-overlay").remove();
106				$('body').css('overflow', 'initial'); /* restore body scrollbars */
107			}, 600); // delay('slow') is 600ms
108		    }
109		</script>
110	   </div>
111	`).appendTo('body')
112	  .delay('fast') /* step 1: wait for div created so that animation can work  */
113	  .queue(function() { /* step 2: open the div and see the fadeIn effect */
114		$(".app-drawer-wrapper").addClass("drawer-open");
115		$(".app-drawer-overlay").removeClass("d-none");
116		$('body').css('overflow', 'hidden'); /* hide body scrollbars */
117 	});
118
119	// tell the browser not to respond to the link click
120	//e.preventDefault();
121	return false;
122}
123
124/*
125 * Added by George on 20200913
126 * Description: If current URL has mode=iframe then append it to child links upon click or submit event.
127 * Note: Both browser location bar and iFrame src are current url.
128 */
129console.log('add_display_mode: top='+top.location + '\n\nparent='+parent.location + '\n\nwindow=' + window.location);
130function add_display_mode(e) {
131
132	// Both browser location bar and iFrame src are current url.
133	const params = new URLSearchParams(window.location.search); // current URL's params
134	console.log('mode=' + params.get('mode')); 
135
136	//alert(window.location.href);
137	if (params.has('mode')) { // current url has mode=iframe
138		console.log('indexPath=' + indexPath);
139		console.log('attr=' + $(this).attr('href'));
140		console.log('prop=' + $(this).prop('href'));
141
142		//alert($(this).prop('tagName')); // either 'A' or 'FORM'
143		href_or_action = $(this).prop('tagName')=='A'?'href':'action';
144
145		if ($(this).prop(href_or_action) == '') { // use .prop() to detect undefined url
146			console.log('EPMS->init_js->add_display_mode_: no attr for ' + href_or_action);
147			return;
148		}
149
150		if ($(this).attr(href_or_action).startsWith(indexPath)) { // interested only in EPMS domain's link
151			var link = new URL($(this).attr(href_or_action)); // Get current url
152			if (link.search) {
153				// if link has "mode" then preserve it.
154				if (link.search.indexOf("mode=")===-1) // not found
155					link += '&mode=' + params.get('mode');
156			} else
157				link += '?mode=' + params.get('mode');
158			$(this).attr(href_or_action, link); // Set herf value
159			//alert(link);
160		}
161	}
162
163	// tell the browser not to respond to the link click
164	//e.preventDefault();
165}
166
167$("a").on('click', add_display_mode);
168$("form").on('submit', add_display_mode);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.