PageSourceSearch

https://remotive.com/remotive_website_job/static/refactoring/js/v2/v2.js?v=6

js remotive.com collected 2026-09-25 04:08:10 UTC 9,502 bytes, 263 lines download raw bytes

1var openMenuBtn = document.getElementById('openMenuBtn');
2if (openMenuBtn) {
3    openMenuBtn.addEventListener('click', function() {
4        var menu = document.getElementById('burgerMenu');
5        if (!menu) {
6            return;
7        }
8        if (menu.style.display === 'block') {
9            menu.style.display = 'none';
10        } else {
11            menu.style.display = 'block';
12        }
13    });
14}
15
16var _mobileSheetSourceDropdown = null;
17
18function closeMobileFilterSheet() {
19    var overlay = document.getElementById('filter-mobile-overlay');
20    var sheet = document.getElementById('filter-mobile-sheet');
21    var content = document.getElementById('filter-mobile-sheet-content');
22    if (!sheet || !overlay) return;
23
24    // Move the panel back to its original dropdown and restore hidden state
25    if (_mobileSheetSourceDropdown && content.firstChild) {
26        var panelToReturn = content.firstChild;
27        panelToReturn.style.display = '';
28        _mobileSheetSourceDropdown.appendChild(panelToReturn);
29    }
30    _mobileSheetSourceDropdown = null;
31
32    sheet.classList.remove('sheet-open');
33    overlay.classList.remove('overlay-open');
34    // Hide after transition
35    setTimeout(function() {
36        sheet.style.display = 'none';
37        overlay.style.display = 'none';
38    }, 260);
39}
40
41function toggleFilterDropdown(id) {
42    var target = document.getElementById(id);
43    if (!target) return;
44
45    var isMobile = window.innerWidth <= 768;
46
47    if (isMobile) {
48        var overlay = document.getElementById('filter-mobile-overlay');
49        var sheet = document.getElementById('filter-mobile-sheet');
50        var sheetContent = document.getElementById('filter-mobile-sheet-content');
51        var sheetTitle = document.getElementById('filter-mobile-sheet-title');
52        if (!sheet || !overlay || !sheetContent) return;
53
54        // If same dropdown is already open in sheet, close it
55        if (_mobileSheetSourceDropdown === target) {
56            closeMobileFilterSheet();
57            return;
58        }
59
60        // If another sheet is open, close it first (move panel back)
61        if (_mobileSheetSourceDropdown) {
62            var prevContent = sheetContent.firstChild;
63            if (prevContent) {
64                prevContent.style.display = '';
65                _mobileSheetSourceDropdown.appendChild(prevContent);
66            }
67            _mobileSheetSourceDropdown = null;
68        }
69
70        // Get the title from the button text (strip the arrow span)
71        var btn = target.querySelector('.filter-dropdown-btn');
72        var arrow = btn && btn.querySelector('.filter-dropdown-arrow');
73        var titleText = btn ? btn.textContent.replace(arrow ? arrow.textContent : '▾', '').trim() : '';
74        if (sheetTitle) sheetTitle.textContent = titleText;
75
76        // Move the panel into the sheet and force it visible
77        var panel = target.querySelector('.filter-dropdown-panel');
78        if (!panel) return;
79        sheetContent.appendChild(panel);
80        panel.style.display = 'block';
81        _mobileSheetSourceDropdown = target;
82
83        // Show overlay and sheet
84        overlay.style.display = 'block';
85        sheet.style.display = 'flex';
86        // Trigger transition on next frame
87        requestAnimationFrame(function() {
88            requestAnimationFrame(function() {
89                sheet.classList.add('sheet-open');
90                overlay.classList.add('overlay-open');
91            });
92        });
93        return;
94    }
95
96    // Desktop: original behavior
97    var isOpen = target.classList.contains('open');
98    document.querySelectorAll('.filter-dropdown.open').forEach(function(el) {
99        if (el.id !== id) el.classList.remove('open');
100    });
101    if (isOpen) {
102        target.classList.remove('open');
103    } else {
104        target.classList.add('open');
105    }
106}
107
108document.addEventListener('click', function(e) {
109    if (!e.target.closest('.filter-dropdown')) {
110        document.querySelectorAll('.filter-dropdown.open').forEach(function(el) {
111            el.classList.remove('open');
112        });
113    }
114});
115
116
117//document.getElementById('closeMenuBtn').addEventListener('click', function() {
118//    document.getElementById('burgerMenu').style.display = 'none';
119//    document.getElementById('openMenuBtn').style.display = 'block';
120//});
121//
122//document.getElementById('searchBtn').addEventListener('click', function() {
123//    document.getElementById('burgerMenu').style.display = 'none';
124//    document.getElementById('openMenuBtn').style.display = 'block';
125//});
126
127
128function toggleDescription(button) {
129  // Traverse the DOM to find the nearest .jt-description element
130  var content = button.closest('.jt-expandable').querySelector('.jt-description');
131
132  // Toggle the hidden class based on its presence
133  content.classList.toggle('hidden');
134
135  // Change the button text accordingly
136  if (content.classList.contains('hidden')) {
137    button.textContent = '+ see more';
138  } else {
139    button.textContent = '− see less';
140//    content.style.max-height = content.scrollHeight + "px"; // Ensures proper height set
141  }
142}
143
144function reportJob(button) {
145    // Trigger change event to set initial state on page load
146    document.getElementById("reason").dispatchEvent(new Event('change'));
147    document.getElementById("report-job-id").value = button.getAttribute("data-job-id");
148    document.getElementById("report-job-title").textContent = button.getAttribute("data-job-title"); // Set the job title
149    document.getElementById("report-popup").classList.remove("tw-hidden");
150}
151
152function closeReportPopup() {
153    document.getElementById("report-popup").classList.add("tw-hidden");
154    document.getElementById("report-form").reset();
155    document.getElementById("report-job-title").textContent = "";
156}
157
158document.getElementById("reason").addEventListener("change", function() {
159    const commentContainer = document.getElementById("comment-container");
160    const commentField = document.getElementById("comment");
161    if (this.value === "dead") {
162        commentContainer.style.display = "none";
163        commentField.required = false;
164    } else {
165        commentContainer.style.display = "flex";
166        commentField.required = true;
167    }
168});
169
170
171
172document.getElementById("report-form").addEventListener("submit", function(e) {
173    e.preventDefault();
174    const formData = {
175        job_id: this.reportJobId.value,
176        reason: this.reason.value,
177        comment: this.comment.value
178    };
179    fetch('/api/accelerator/job/report', {
180        method: 'POST',
181        headers: {
182            'Content-Type': 'application/json'
183        },
184        body: JSON.stringify(formData)
185    })
186    .then(response => response.json())
187    .then(data => {
188        // console.log('Success:', data);
189        closeReportPopup();
190    })
191    .catch((error) => {
192        console.error('Error:', error);
193    });
194});
195
196
197
198
199//
200//function injectContentBasedOnScreenSize() {
201//    var content  = `
202//    <div class="tw-p-3 tw-mb-4 tw-border tw-border-gray-200 tw-rounded-md" style="min-height:130px">
203//        <span class="h3 tw-mb-4">I want to work remotely from...</span>
204//        <div id="location-filter"></div>
205//    </div>
206//    <div class="tw-p-3 tw-mb-4 tw-border tw-border-gray-200 tw-rounded-md" style="min-height:130px">
207//        <span class="h3 tw-mb-4">Skills</span>
208//        <div id="skill-filter"></div>
209//    </div>
210//    <div class="tw-p-3 tw-mb-4 tw-border tw-border-gray-200 tw-rounded-md" style="min-height:130px">
211//        <span class="h3 tw-mb-4">Employment Types</span>
212//        <div id="job-type-filter" class="side-filter"></div>
213//    </div>
214//    <div class="tw-p-3 tw-mb-4 tw-border tw-border-gray-200 tw-rounded-md" style="min-height:130px">
215//        <span class="h3 tw-mb-4">Seniority Level</span>
216//        <div id="seniority-filter" class="side-filter"></div>
217//    </div>
218//    <div class="tw-p-3 tw-mb-4 tw-border tw-border-gray-200 tw-rounded-md" style="min-height:130px">
219//        <span class="h3 tw-mb-4">Min salary (USD/year)</span>
220//        <div id="min-salary-filter" class="side-filter"></div>
221//    </div>
222//    `;
223//    var mobileBreakpoint = 768; // Define mobile breakpoint, e.g., 768px for tablets
224//
225//    var container;
226//    if (window.innerWidth <= mobileBreakpoint) {
227//        // If screen size is mobile
228//        container = document.getElementById('filters-container-mobile');
229//    } else {
230//        // If screen size is desktop
231//        container = document.getElementById('filters-container-desktop');
232//    }
233//
234//    // Inject the content into the chosen container
235//    if (container) {
236//        container.innerHTML = content;
237//    }
238//}
239//document.addEventListener('DOMContentLoaded', function() {
240//    injectContentBasedOnScreenSize();
241//});
242//// Debouncing function
243//function debounce_filters(func, wait, immediate) {
244//    var timeout;
245//    return function() {
246//        var context = this, args = arguments;
247//        var later = function() {
248//            timeout = null;
249//            if (!immediate) func.apply(context, args);
250//        };
251//        var callNow = immediate && !timeout;
252//        clearTimeout(timeout);
253//        timeout = setTimeout(later, wait);
254//        if (callNow) func.apply(context, args);
255//    };
256//};
257//
258//// Handle window resize with debouncing
259//var debouncedResize = debounce_filters(function() {
260//    injectContentBasedOnScreenSize();
261//}, 250); // 250 milliseconds is a good balance for responsiveness and performance
262//
263//window.addEventListener('resize', debouncedResize);

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.