<commit_before>
(function () {
    "use strict";

    // Add the event listener to handle Windows activated event
    if (typeof Windows !== "undefined" &&
            typeof Windows.UI !== "undefined" &&
            typeof Windows.UI.WebUI !== "undefined") {
	    Windows.UI.WebUI.WebUIApplication.addEventListener('activated', function (args) {
	        var activation = Windows.ApplicationModel.Activation;
            console.log("The app is activated");
            console.log("The tyoe of activation received: " + args.kind);
            console.log("The args received: " + args.arguments);
            console.log("Toast activation kind: " + activation.ActivationKind.toastNotification);

            // Handle applcation launch from the Windows OS
            if (args.kind === activation.ActivationKind.launch) {
                // The app has been activated from launch

                if(args.arguments) {
                    var launchArgs = JSON.parse(args.arguments);
                    // Handle launch from Toast Notification
                    if (launchArgs.type === "toast") {
                       console.log("These are the launch args:");
                       console.log(launchArgs);
                    }
                }
            }
            // Handle user interaction from toast notification on Windows
	        else if (args.kind === activation.ActivationKind.toastNotification) {
                console.log("Notification clicked");
	            console.log(args.argument);
	            console.log(args.userInput.textReply);
                toastHandler(args.argument, args.userInput.textReply);
	        }
	    });
	}
	
})();

function toastHandler (args, userText) {

}

function createToast(title, message, imgUrl, imgAlt, tag, lang) {
	"use strict";
	    
    // Namespace: Windows.UI.Notifications
    if (typeof Windows !== 'undefined' &&
            typeof Windows.UI !== 'undefined' &&
            typeof Windows.UI.Notifications !== 'undefined') {
        // Setup variables for shorthand
        var notifications = Windows.UI.Notifications,
            templateType = notifications.ToastTemplateType.toastImageAndText02,
            templateContent = notifications.ToastNotificationManager.getTemplateContent(templateType),
            toastMessage = templateContent.getElementsByTagName('text'),
            toastImage = templateContent.getElementsByTagName('image'),
            toastElement = templateContent.selectSingleNode('/toast');

        var launchParams = {
            type: "toast",
            id: tag || "demoToast",
            heading: title || "Demo title",
            body: message || "Demo message"
        };

        var launchString = JSON.stringify(launchParams);
      
        // Set message & image in toast template
        toastMessage[0].appendChild(templateContent.createTextNode(message || 'Demo message'));
        toastImage[0].setAttribute('src', imgUrl || 'https://unsplash.it/150/?random');
        toastImage[0].setAttribute('alt', imgAlt || 'Random sample image');
        toastElement.setAttribute('duration', 'long');
        toastElement.setAttribute('launch', launchString); // Optional Launch Parameter

        // Add actions
        var actions = templateContent.createElement('actions');
        templateContent.firstChild.appendChild(actions);

        // Create an input box
        var input = templateContent.createElement('input');
        input.setAttribute('type', 'text');
        input.setAttribute('title', 'Reply with');
        input.setAttribute('id', 'textReply');
        actions.appendChild(input);

            // Create a yes button
        var btnYes = templateContent.createElement('action');
        btnYes.setAttribute('content', 'Yes');
        btnYes.setAttribute('arguments', 'yes');
        btnYes.setAttribute('launchType', 'foreground');
        actions.appendChild(btnYes);

            //Create a no button
        var btnNo = templateContent.createElement('action');
        btnNo.setAttribute('content', 'No');
        btnNo.setAttribute('arguments', 'no');
        btnNo.setAttribute('launchType', 'foreground');
        actions.appendChild(btnNo);

        // Show the toast
        var toast = new notifications.ToastNotification(templateContent);
        var toastNotifier = new notifications.ToastNotificationManager.createToastNotifier();
        toastNotifier.show(toast);

    } else if ("Notification" in window) {

        //Set the title
        var _title = title || "Yo!"; 

        //Set the options
        var options = {
            body: message || "Demo message",
            icon: imgUrl || "https://unsplash.it/150/?random",
            tag: tag || "DemoN",
            lang: lang || "en-us"
        };
        <commit_msg>cleaning up Windows Toast Notifications<commit_after>
(function () {
    "use strict";

    // Add the event listener to handle Windows activated event
    if (typeof Windows !== "undefined" &&
            typeof Windows.UI !== "undefined" &&
            typeof Windows.UI.WebUI !== "undefined") {
	    Windows.UI.WebUI.WebUIApplication.addEventListener('activated', function (args) {
	        var activation = Windows.ApplicationModel.Activation;

            // Handle applcation launch from the Windows OS
            if (args.kind === activation.ActivationKind.launch) {
                // Check if there are launch args
                if(args.arguments) {
                    var launchArgs = JSON.parse(args.arguments);

                    if (launchArgs.type === "toast") {
                        console.log(args);
                        // The app has been launched from the click of a notification
                        //console.log("The app has been launched from a toast click. These are the launch args:");
                        //console.log(launchArgs);
                    }
                }
            }
            // Handle user interaction from toast notification on Windows
	        else if (args.kind === activation.ActivationKind.toastNotification) {
                console.log(args);
                toastHandler(args.argument, args.userInput.textReply);
	        }
	    });
	}
	
})();

function toastHandler (btnClicked, userText) {
    //console.log("User clicked on the: " + btnClicked + " button");
    //console.log("User replied with: " + userText);

}

function createToast(title, message, imgUrl, imgAlt, tag, lang) {
	"use strict";
	    
    // Namespace: Windows.UI.Notifications
    if (typeof Windows !== 'undefined' &&
            typeof Windows.UI !== 'undefined' &&
            typeof Windows.UI.Notifications !== 'undefined') {
        // Setup variables for shorthand
        var notifications = Windows.UI.Notifications,
            templateType = notifications.ToastTemplateType.toastImageAndText02,
            templateContent = notifications.ToastNotificationManager.getTemplateContent(templateType),
            toastMessage = templateContent.getElementsByTagName('text'),
            toastImage = templateContent.getElementsByTagName('image'),
            toastElement = templateContent.selectSingleNode('/toast');

        var launchParams = {
            type: "toast",
            id: tag || "demoToast",
            heading: title || "Demo title",
            body: message || "Demo message"
        };

        var launchString = JSON.stringify(launchParams);
      
        // Set message & image in toast template
        toastMessage[0].appendChild(templateContent.createTextNode(message || 'Demo message'));
        toastImage[0].setAttribute('src', imgUrl || 'https://unsplash.it/150/?random');
        toastImage[0].setAttribute('alt', imgAlt || 'Random sample image');
        toastElement.setAttribute('duration', 'long');
        toastElement.setAttribute('launch', launchString); // Optional Launch Parameter

        // Add actions
        var actions = templateContent.createElement('actions');
        templateContent.firstChild.appendChild(actions);

        // Create an input box
        var input = templateContent.createElement('input');
        input.setAttribute('type', 'text');
        input.setAttribute('title', 'Reply with');
        input.setAttribute('id', 'textReply');
        actions.appendChild(input);

        // Create a yes button
        var btnYes = templateContent.createElement('action');
        btnYes.setAttribute('content', 'Yes');
        btnYes.setAttribute('arguments', 'yes');
        btnYes.setAttribute('launchType', 'foreground');
        actions.appendChild(btnYes);

        //Create a no button
        var btnNo = templateContent.createElement('action');
        btnNo.setAttribute('content', 'No');
        btnNo.setAttribute('arguments', 'no');
        btnNo.setAttribute('launchType', 'foreground');
        actions.appendChild(btnNo);

        // Show the toast
        var toast = new notifications.ToastNotification(templateContent);
        var toastNotifier = new notifications.ToastNotificationManager.createToastNotifier();
        toast.tag = "demoToast";
        console.log(toast);        
        toastNotifier.show(toast);

    } else if ("Notification" in window) {

        //Set the title
        var _title = title || "Yo!"; 

        //Set the options
        var options = {
            body: message || "Demo message",
            icon: imgUrl || "https://unsplash.it/150/?random",
            tag: tag || "DemoN",
            lang: lang || "en-us"
        };
        
{'fraction_non_alphanumeric': 0.11806873286949188, 'fraction_numerical': 0.0023192072527935905, 'mean_word_length': 2.2601374570446735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773811', 'n_tokens_mistral': 2372, 'n_tokens_neox': 2290, 'n_words': 561}