<commit_before>( function( mw, $ ) {

    "use strict";


    mw.HtmlBinderHelper=function(element, $scope) {

        var internal = {};
        var updaters = {};
        return {

            bind: function () {

                var parser=function(originalText,updateHtml) {
                    var matches = originalText.match(/{{(.*)}}/g);


                    if (matches && matches.length > 0) {
                        matches.forEach(function (match) {
                            var name = match.slice(2, -2);

                            var filterIndex=name.indexOf('|');
                            var filter;
                            if (filterIndex>0) {
                                var filterName=name.substring(filterIndex+1).trim();
                                name=name.substring(0,filterIndex).trim();
                                filter=$scope[filterName];
                            }

                            var updater=function() {

                                var value=internal[name];
                                if (!value) {
                                    value="";
                                }

                                var newContent = originalText.replace(match,value);
                                if (filter) {
                                    newContent=filter(newContent);
                                }
                                updateHtml(newContent);
                            };

                            defineProp(name, updater);

                            updater();
                        });
                    }
                };


                var defineProp = function (name, updateHtml) {
                    //copy from old defenition
                    if (!internal.hasOwnProperty(name)) {
                        internal[name] = $scope[name];
                        updaters[name] = [];
                    }

                    if (!$scope.hasOwnProperty(name)) {
                        updaters[name] = [];
                        var updater = updaters[name];
                        Object.defineProperty($scope, name, {
                            get: function () {
                                return internal[name];
                            },
                            set: function (newValue) {
                                try {
                                    if (internal[name] !== newValue) {
                                        internal[name] = newValue;

                                        for (var i = 0; i < updater.length; i++) {
                                            updater[i]();
                                        }
                                    }
                                }
                                catch (e) {
                                    mw.log("exception in Object.defineProperty " + e.message + " " + e.stack);
                                }
                            }
                        });
                    }
                    updaters[name].push(updateHtml);
                };

                $('*',element).each(function ($index, el) {

                    var shouldShowValue=el.getAttribute("ng-show");
                    if (shouldShowValue) {
                        var updateHtml=function() {
                            var newContent =  internal[shouldShowValue];
                            if (newContent) {
                                el.style.display = "inherit";
                            } else {
                                el.style.display = "none";
                            }

                        };

                        defineProp(shouldShowValue, updateHtml);

                        updateHtml();

                    }
                    if(el.childNodes.length>1) {
                        return;
                    }
                    var originalText = el.innerText;

                    parser(originalText, function(newContent) {
                        el.innerHTML = newContent;
                    });


                    $(el.attributes).each(function (index, element) {
                        //var elementName = element.name;
                        var originalValue = element.value;


                        parser(originalValue, function(newContent) {
                            element.value = newContent;
                        });


                    });


                });

            }
        }
    }
} )( window.mw, window.jQuery );<commit_msg>fix safari<commit_after>( function( mw, $ ) {

    "use strict";


    mw.HtmlBinderHelper=function(element, $scope) {

        var internal = {};
        var updaters = {};
        return {

            bind: function () {

                var parser=function(originalText,updateHtml) {
                    var matches = originalText.match(/{{(.*)}}/g);


                    if (matches && matches.length > 0) {
                        matches.forEach(function (match) {
                            var name = match.slice(2, -2);

                            var filterIndex=name.indexOf('|');
                            var filter;
                            if (filterIndex>0) {
                                var filterName=name.substring(filterIndex+1).trim();
                                name=name.substring(0,filterIndex).trim();
                                filter=$scope[filterName];
                            }

                            var updater=function() {

                                var value=internal[name];
                                if (!value) {
                                    value="";
                                }

                                var newContent = originalText.replace(match,value);
                                if (filter) {
                                    newContent=filter(newContent);
                                }
                                updateHtml(newContent);
                            };

                            defineProp(name, updater);

                            updater();
                        });
                    }
                };


                var defineProp = function (name, updateHtml) {
                    //copy from old defenition
                    if (!internal.hasOwnProperty(name)) {
                        internal[name] = $scope[name];
                        updaters[name] = [];
                    }

                    if (!$scope.hasOwnProperty(name)) {
                        updaters[name] = [];
                        var updater = updaters[name];
                        Object.defineProperty($scope, name, {
                            get: function () {
                                return internal[name];
                            },
                            set: function (newValue) {
                                try {
                                    if (internal[name] !== newValue) {
                                        internal[name] = newValue;

                                        for (var i = 0; i < updater.length; i++) {
                                            updater[i]();
                                        }
                                    }
                                }
                                catch (e) {
                                    mw.log("exception in Object.defineProperty " + e.message + " " + e.stack);
                                }
                            }
                        });
                    }
                    updaters[name].push(updateHtml);
                };

                $('*',element).each(function ($index, el) {

                    var shouldShowValue=el.getAttribute("ng-show");
                    if (shouldShowValue) {
                        var updateHtml=function() {
                            var newContent =  internal[shouldShowValue];
                            if (newContent) {
                                el.style.display = "inherit";
                            } else {
                                el.style.display = "none";
                            }

                        };

                        defineProp(shouldShowValue, updateHtml);

                        updateHtml();

                    }
                    if(el.childNodes.length>1) {
                        return;
                    }
                    var originalText = el.innerHTML;

                    parser(originalText, function(newContent) {
                        el.innerHTML = newContent;
                    });


                    $(el.attributes).each(function (index, element) {
                        //var elementName = element.name;
                        var originalValue = element.value;


                        parser(originalValue, function(newContent) {
                            element.value = newContent;
                        });


                    });


                });

            }
        }
    }
} )( window.mw, window.jQuery );
{'fraction_non_alphanumeric': 0.0904016635657218, 'fraction_numerical': 0.001751121812411076, 'mean_word_length': 0.6909696521095485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3948889', 'n_tokens_mistral': 1950, 'n_tokens_neox': 1743, 'n_words': 307}