No edit summary
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
(5 intermediate revisions by the same user not shown)
Line 81: Line 81:
         <!-- New search input field for suggestions -->
         <!-- New search input field for suggestions -->
         <input
         <input
             id="customsearch-input"
             id="customsearchs-input"
             class="search-input"
             class="search-inputs"
             type="text"
             type="text"
             placeholder="Search MDriven Learn"
             placeholder="Search MDriven Learn"
Line 89: Line 89:
             autocomplete="off"
             autocomplete="off"
         >
         >
         <div id="suggestion-container" style="
         <div id="suggestion-container"></div>
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            background: #fff;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.15);
            display: none;
            z-index: 9999;
        ">
            <ul id="suggestion-list" style="list-style: none; margin: 0; padding: 0;"></ul>
        </div>
     </form>
     </form>
</div>
</div>
Line 136: Line 123:
{{#widget:Card|heading=Best Practices|display=block|imageIcon=/images/main4.svg|subheading=Explore effective solutions|text=Our suggestions on how you can maximize the benefits of the MDriven tools to realize business solutions.|link=/index.php/BestPractices:Best_Practices|linktext=Try these Best Practices}}
{{#widget:Card|heading=Best Practices|display=block|imageIcon=/images/main4.svg|subheading=Explore effective solutions|text=Our suggestions on how you can maximize the benefits of the MDriven tools to realize business solutions.|link=/index.php/BestPractices:Best_Practices|linktext=Try these Best Practices}}
<html>
<html>
<script>
  (function() {
    const input = document.getElementById('customsearch-input');
    const suggestionsBox = document.getElementById('suggestion-container');
    const suggestionList = document.getElementById('suggestion-list');
    let lastFetchController = null;
    // Hide suggestions
    function hideSuggestions() {
      suggestionsBox.style.display = 'none';
    }
    // Show suggestions
    function showSuggestions() {
      suggestionsBox.style.display = 'block';
    }
    // Populate suggestions in the dropdown
    function updateSuggestions(suggestions) {
      suggestionList.innerHTML = '';
      if (!suggestions.length) {
        hideSuggestions();
        return;
      }
      suggestions.forEach(sugg => {
        const li = document.createElement('li');
        li.textContent = sugg;
        li.style.padding = '8px 12px';
        li.style.cursor = 'pointer';
        li.addEventListener('click', () => {
          input.value = sugg;
          hideSuggestions();
        });
        suggestionList.appendChild(li);
      });
      showSuggestions();
    }
    // Fetch suggestions on user input
    input.addEventListener('input', async function() {
      const query = this.value.trim();
      if (!query) {
        hideSuggestions();
        return;
      }
      // Cancel previous fetch if the user types quickly
      if (lastFetchController) {
        lastFetchController.abort();
      }
      lastFetchController = new AbortController();
      const signal = lastFetchController.signal;
      try {
        const response = await fetch(
          `https://search-api.mdriven.net/wiki_suggestions?q=${encodeURIComponent(query)}`,
          { signal }
        );
        if (!response.ok) {
          console.error('Suggestion request failed:', response.statusText);
          return;
        }
        const data = await response.json();
        updateSuggestions(data);
      } catch (err) {
        if (err.name === 'AbortError') {
          return;
        }
        console.error('Error fetching suggestions:', err);
      }
    });
    // Hide suggestions on clicking outside
    document.addEventListener('click', (e) => {
      if (!suggestionsBox.contains(e.target) && e.target !== input) {
        hideSuggestions();
      }
    });
  })();
</script>


</div>
</div>

Revision as of 13:29, 31 March 2025

MDriven Learn
Learn. Model. Build.
Visualize and design your ideas. Discover more with MDriven documentation, hands-on training, and ready-made models to get the most from MDriven's tools and services.
Image
Icon
Documentation
Find technical documentation
Gain understanding through in-depth explanations of the concepts behind the MDriven tools.
Icon
Training
Learn by doing
Practical training and tutorials on MDriven designed to educate and inspire you to model your ideas.
Icon
Q&A
Ask questions and get help
Write to us your MDriven-related questions and receive quality answers and feedback.
Icon
Model Examples
Try model samples
Use our unique, pre-built models to build your ideas and achieve your goals.
Icon
Best Practices
Explore effective solutions
Our suggestions on how you can maximize the benefits of the MDriven tools to realize business solutions.


MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments