MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1,176: Line 1,176:
     $(".oo-ui-actionFieldLayout-button .oo-ui-buttonInputWidget").remove();
     $(".oo-ui-actionFieldLayout-button .oo-ui-buttonInputWidget").remove();


     document.addEventListener("DOMContentLoaded", function() {
     // Check if #submit button exists and add event listener if it does
        console.log("DOM fully loaded and parsed.");
    var submitButton = document.querySelector('#submit');
   
    console.log("Submit button:", submitButton);
        // Select the submit button
 
        var submitButton = document.querySelector('#submit');
     if (submitButton) {
        console.log("Submit button:", submitButton);
        console.log("#submit button found.");
      
 
        // Check if submitButton exists
        // Add click event listener
        if (submitButton) {
        submitButton.addEventListener('click', function(event) {
            console.log("#submit button found.");
            console.log("Submit button clicked.");
   
            event.preventDefault(); // Prevent the default link behavior
            // Add click event listener
 
            submitButton.addEventListener('click', function(event) {
            var email = 'submit@softwear.directory';
                console.log("Submit button clicked.");
            var subject = 'new entry to the softwear directory';
                event.preventDefault(); // Prevent the default link behavior
            var body = '☺ the following content could be interesting for the directory:\n\n' +
   
                      '[ author / creator ]\n\n' +
                var email = 'submit@softwear.directory';
                      '---\n\n' +
                var subject = 'new entry to the softwear directory';
                      '[ title ]\n\n' +
                var body = '☺ the following content could be interesting for the directory:\n\n' +
                      '---\n\n' +
                          '[ author / creator ]\n\n' +
                      '[ why should it be included? ]\n\n' +
                          '---\n\n' +
                      '---\n\n' +
                          '[ title ]\n\n' +
                      '[ link or pdf ]\n\n' +
                          '---\n\n' +
                      '---\n\n' +
                          '[ why should it be included? ]\n\n' +
                      '[ your name / contact / social ]\n\n' +
                          '---\n\n' +
                      '---';
                          '[ link or pdf ]\n\n' +
 
                          '---\n\n' +
            var mailtoLink = 'mailto:' + encodeURIComponent(email) +
                          '[ your name / contact / social ]\n\n' +
                            '?subject=' + encodeURIComponent(subject) +
                          '---';
                            '&body=' + encodeURIComponent(body).replace(/%20/g, ' ');
   
 
                var mailtoLink = 'mailto:' + encodeURIComponent(email) +
            console.log("Generated mailto link:", mailtoLink);
                                '?subject=' + encodeURIComponent(subject) +
 
                                '&body=' + encodeURIComponent(body).replace(/%20/g, ' ');
            window.location.href = mailtoLink;
   
        });
                console.log("Generated mailto link:", mailtoLink);
    } else {
   
        console.warn('#submit button not found on this page.');
                window.location.href = mailtoLink;
     }
            });
        } else {
            console.warn('#submit button not found on this page.');
        }
     });   
});
});

Navigation menu