PageSourceSearch

https://ism.gov.in/Assets/js/common/common.js?v=1790265346

js ism.gov.in collected 2026-09-24 10:25:58 UTC 6,444 bytes, 183 lines download raw bytes

1document.querySelectorAll('.attachment-button .file-name').forEach(function (el) {
2    const fullText = el.textContent.trim();
3
4    // Split extension from filename
5    const lastDotIndex = fullText.lastIndexOf(".");
6    const namePart = fullText.substring(0, lastDotIndex);
7    const extension = fullText.substring(lastDotIndex); // includes the dot
8
9    // Truncate name if longer than 25 characters
10    const truncatedName = namePart.length > 15 ? namePart.slice(0, 15) + '...' : namePart;
11    el.textContent = truncatedName + extension;
12});
13
14var CommonController = {
15    ChangePassword : function(){
16        document.getElementById("change-password-button").addEventListener("click", function (e) {
17            const password = document.getElementById("NewPassword").value;
18            const confirmPassword = document.getElementById("ConfirmNewPassword").value;
19
20            const isValid = validatePasswords(password, confirmPassword);
21            if (!isValid) {
22                e.preventDefault();
23            }
24        });
25    },
26
27    intervalId: null,
28
29    UpdateDateTime: function(){
30        const now = new Date();
31        const options = { day: 'numeric', month: 'long', year: 'numeric' };
32        const formattedDate = now.toLocaleDateString('en-GB', options);
33
34        const formattedTime = now.toLocaleTimeString('en-US', {
35            hour: '2-digit',
36            minute: '2-digit',
37            second: '2-digit',
38            hour12: true
39        }).replace(/:/g, ' : ');
40
41        document.getElementById('date').textContent = formattedDate + ' |';
42        document.getElementById('time').innerHTML = ' ' + formattedTime;
43
44        if (!this.intervalId) {
45            this.intervalId = setInterval(this.UpdateDateTime.bind(this), 1000);
46        }
47    },  
48    
49    
50    Remarks: function () {
51        const maxLength = 5;
52
53        document.querySelectorAll(".remarks-text").forEach(function (el) {
54
55            if (el.dataset.processed) return;
56
57            const fullText = el.innerText.trim();
58
59            if (fullText.length > maxLength) {
60
61                const shortText = fullText.substring(0, maxLength) + "...";
62
63                el.innerHTML = `
64                            <span class="short-text">${shortText}</span>
65                    <span class="full-text d-none">${fullText}</span>
66                    <a href="javascript:void(0)" class="toggle-remarks text-primary">
67                        View More
68                    </a>
69                `; 
70            }
71        });
72
73        document.addEventListener("click", function (e) {
74
75            if (e.target.classList.contains("toggle-remarks")) {
76
77                const parent = e.target.closest(".remarks-text");
78                const shortText = parent.querySelector(".short-text");
79                const fullText = parent.querySelector(".full-text");
80
81                if (fullText.classList.contains("d-none")) {
82                    shortText.classList.add("d-none");
83                    fullText.classList.remove("d-none");
84                    e.target.innerText = "View Less";
85                } else {
86                    shortText.classList.remove("d-none");
87                    fullText.classList.add("d-none");
88                    e.target.innerText = "View More";
89                }
90            }
91        });
92    },
93
94    ApplyShowMore: function () {
95
96            const maxLength = 5; // change as needed
97
98            document.querySelectorAll(".remarks-text").forEach(function (el) {
99
100                if (el.dataset.processed) return; // prevent duplicate processing
101
102                const fullText = el.innerText.trim();
103
104                if (fullText.length > maxLength) {
105
106                    const shortText = fullText.substring(0, maxLength) + "... ";
107
108                    el.innerHTML = `
109                            <span class="short-text">${shortText}</span>
110                            <span class="full-text d-none">${fullText}</span>
111                            <a href="javascript:void(0)" class="toggle-remarks text-primary">View More</a>
112                        `;
113
114                    el.dataset.processed = "true";
115                }
116            });
117        }
118};
119
120
121
122function validatePasswords(password, confirmPassword) {
123    const minLength = 12;
124    const hasLowercase = /[a-z]/.test(password);
125    const hasUppercase = /[A-Z]/.test(password);
126    const hasNumber = /\d/.test(password);
127    const hasSpecialChar = /[!#*_?-@]/.test(password);
128
129    const errorMessageSetPassword = document.getElementById("error-message-set-password");
130    errorMessageSetPassword.textContent = ""; // Clear previous error
131    errorMessageSetPassword.style.display = "none";
132    if (password.length < minLength) {
133        errorMessageSetPassword.textContent = "Password must be at least 12 characters long.";
134        errorMessageSetPassword.style.display = "block";
135        return false;
136    }
137    else if (!hasLowercase) {
138        errorMessageSetPassword.textContent = "Password must contain at least one lowercase letter.";
139        errorMessageSetPassword.style.display = "block";
140        return false;
141    }
142    else if (!hasUppercase) {
143        errorMessageSetPassword.textContent = "Password must contain at least one uppercase letter.";
144        errorMessageSetPassword.style.display = "block";
145        return false;
146    }
147    else if (!hasNumber) {
148        errorMessageSetPassword.textContent = "Password must contain at least one number.";
149        errorMessageSetPassword.style.display = "block";
150        return false;
151    }
152    else if (!hasSpecialChar) {
153        errorMessageSetPassword.textContent = "Password must contain at least one special character (!,#,*_?-).";
154        errorMessageSetPassword.style.display = "block";
155        return false;
156    }
157    else if (password !== confirmPassword) {
158        errorMessageSetPassword.textContent = "Passwords do not match.";
159        errorMessageSetPassword.style.display = "block";
160        return false;
161    }
162    else {
163        return true;
164    }
165
166
167}
168
169function togglePassword(fieldId, iconElement) {
170    const field = document.getElementById(fieldId);
171    const icon = iconElement.querySelector("i");
172
173    if (field.type === "password") {
174        field.type = "text";
175        icon.classList.remove("fa-eye-slash");
176        icon.classList.add("fa-eye");
177    } else {
178        field.type = "password";
179        icon.classList.remove("fa-eye");
180        icon.classList.add("fa-eye-slash");
181    }
182}
183

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.