Jump to content

Template:Template17

From Oregon Church Wiki
Revision as of 04:40, 14 October 2025 by ORCadmin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Advanced Search
   <label style="display:flex;flex-direction:column;gap:6px;">
     Denomination
     <select id="oc-denom" style="min-width:220px;padding:6px;">
       <option value="">ANY</option>
       <option>Catholic</option>
       <option>Lutheran</option>
       <option>Baptist</option>
       <option>Orthodox</option>
       <option>Non-denominational</option>
       <option>Pentecostal</option>
       <option>Methodist</option>
       <option>Presbyterian</option>
       <option>Anglican</option>
       <option>Evangelical</option>
     </select>
   </label>
   <label style="display:flex;flex-direction:column;gap:6px;">
     County
     <select id="oc-county" style="min-width:220px;padding:6px;">
       <option value="">ANY</option>
       <option>Multnomah</option>
       <option>Washington</option>
       <option>Clackamas</option>
       <option>Lane</option>
       <option>Marion</option>
       <option>Jackson</option>
       <option>Deschutes</option>
       <option>Linn</option>
       <option>Benton</option>
       <option>Yamhill</option>
     </select>
   </label>
   <label style="display:flex;flex-direction:column;gap:6px;">
     Language
     <select id="oc-lang" style="min-width:220px;padding:6px;">
       <option value="">ANY</option>
       <option>Spanish</option>
       <option>Russian</option>
       <option>Korean</option>
       <option>Romanian</option>
       <option>Vietnamese</option>
       <option>Chinese</option>
       <option>Latin</option>
       <option>ASL</option>
     </select>
   </label>
   <button id="oc-run" style="padding:8px 14px;border:1px solid #2e7d32;border-radius:8px;background:#e8f5e9;cursor:pointer;">
     Search
   </button>
   <button id="oc-reset" style="padding:8px 14px;border:1px solid #999;border-radius:8px;background:#f6f6f6;cursor:pointer;">
     Reset
   </button>

<script> (function () {

 // Adjust base URL if your wiki path differs:
 var searchPage = mw.util.getUrl('Special:Search');
 function q(s) { return '"' + s.replace(/"/g, '\\"') + '"'; }
 function buildQuery() {
   var denom  = document.getElementById('oc-denom').value.trim();
   var county = document.getElementById('oc-county').value.trim();
   var lang   = document.getElementById('oc-lang').value.trim();
   var parts = [];
   if (denom) {
     // Denomination categories are exactly the denomination name
     parts.push('incategory:' + q('Category:' + denom));
   }
   if (county) {
     // County categories use the pattern "Churches in ___ County"
     parts.push('incategory:' + q('Category:Churches in ' + county + ' County'));
   }
   if (lang) {
     // Language categories are exactly the language name
     parts.push('incategory:' + q('Category:' + lang));
   }
   // If all are ANY, show all churches: search for pages in any county category
   if (parts.length === 0) {
     // Fallback broad query (edit to taste)
     parts.push('incategory:' + q('Category:Churches in Oregon'));
   }
   return parts.join(' ');
 }
 document.getElementById('oc-run').addEventListener('click', function () {
   var query = buildQuery();
   var url = searchPage + '?search=' + encodeURIComponent(query) + '&ns0=1';
   location.href = url;
 });
 document.getElementById('oc-reset').addEventListener('click', function () {
   document.getElementById('oc-denom').value = ;
   document.getElementById('oc-county').value = ;
   document.getElementById('oc-lang').value = ;
 });

})(); </script>