Code Duplication    Length = 51-51 lines in 2 locations

public/js/tinymce/themes/inlite/theme.js 1 location

@@ 6788-6838 (lines=51) @@
6785
      var value = name in editorSettings ? editorSettings[name] : defaultValue;
6786
      return value === false ? null : value;
6787
    };
6788
    var createMenuItems = function (term, targets, fileType, editorSettings) {
6789
      var separator = { title: '-' };
6790
      var fromHistoryMenuItems = function (history) {
6791
        var historyItems = history.hasOwnProperty(fileType) ? history[fileType] : [];
6792
        var uniqueHistory = filter(historyItems, function (url) {
6793
          return isUniqueUrl(url, targets);
6794
        });
6795
        return global$4.map(uniqueHistory, function (url) {
6796
          return {
6797
            title: url,
6798
            value: {
6799
              title: url,
6800
              url: url,
6801
              attach: noop
6802
            }
6803
          };
6804
        });
6805
      };
6806
      var fromMenuItems = function (type) {
6807
        var filteredTargets = filter(targets, function (target) {
6808
          return target.type === type;
6809
        });
6810
        return toMenuItems(filteredTargets);
6811
      };
6812
      var anchorMenuItems = function () {
6813
        var anchorMenuItems = fromMenuItems('anchor');
6814
        var topAnchor = getSetting(editorSettings, 'anchor_top', '#top');
6815
        var bottomAchor = getSetting(editorSettings, 'anchor_bottom', '#bottom');
6816
        if (topAnchor !== null) {
6817
          anchorMenuItems.unshift(staticMenuItem('<top>', topAnchor));
6818
        }
6819
        if (bottomAchor !== null) {
6820
          anchorMenuItems.push(staticMenuItem('<bottom>', bottomAchor));
6821
        }
6822
        return anchorMenuItems;
6823
      };
6824
      var join = function (items) {
6825
        return foldl(items, function (a, b) {
6826
          var bothEmpty = a.length === 0 || b.length === 0;
6827
          return bothEmpty ? a.concat(b) : a.concat(separator, b);
6828
        }, []);
6829
      };
6830
      if (editorSettings.typeahead_urls === false) {
6831
        return [];
6832
      }
6833
      return fileType === 'file' ? join([
6834
        filterByQuery(term, fromHistoryMenuItems(history)),
6835
        filterByQuery(term, fromMenuItems('header')),
6836
        filterByQuery(term, anchorMenuItems())
6837
      ]) : filterByQuery(term, fromHistoryMenuItems(history));
6838
    };
6839
    var addToHistory = function (url, fileType) {
6840
      var items = history[fileType];
6841
      if (!/^https?/.test(url)) {

public/js/tinymce/themes/modern/theme.js 1 location

@@ 6630-6680 (lines=51) @@
6627
      var value = name in editorSettings ? editorSettings[name] : defaultValue;
6628
      return value === false ? null : value;
6629
    };
6630
    var createMenuItems = function (term, targets, fileType, editorSettings) {
6631
      var separator = { title: '-' };
6632
      var fromHistoryMenuItems = function (history) {
6633
        var historyItems = history.hasOwnProperty(fileType) ? history[fileType] : [];
6634
        var uniqueHistory = filter(historyItems, function (url) {
6635
          return isUniqueUrl(url, targets);
6636
        });
6637
        return global$2.map(uniqueHistory, function (url) {
6638
          return {
6639
            title: url,
6640
            value: {
6641
              title: url,
6642
              url: url,
6643
              attach: noop
6644
            }
6645
          };
6646
        });
6647
      };
6648
      var fromMenuItems = function (type) {
6649
        var filteredTargets = filter(targets, function (target) {
6650
          return target.type === type;
6651
        });
6652
        return toMenuItems(filteredTargets);
6653
      };
6654
      var anchorMenuItems = function () {
6655
        var anchorMenuItems = fromMenuItems('anchor');
6656
        var topAnchor = getSetting(editorSettings, 'anchor_top', '#top');
6657
        var bottomAchor = getSetting(editorSettings, 'anchor_bottom', '#bottom');
6658
        if (topAnchor !== null) {
6659
          anchorMenuItems.unshift(staticMenuItem('<top>', topAnchor));
6660
        }
6661
        if (bottomAchor !== null) {
6662
          anchorMenuItems.push(staticMenuItem('<bottom>', bottomAchor));
6663
        }
6664
        return anchorMenuItems;
6665
      };
6666
      var join = function (items) {
6667
        return foldl(items, function (a, b) {
6668
          var bothEmpty = a.length === 0 || b.length === 0;
6669
          return bothEmpty ? a.concat(b) : a.concat(separator, b);
6670
        }, []);
6671
      };
6672
      if (editorSettings.typeahead_urls === false) {
6673
        return [];
6674
      }
6675
      return fileType === 'file' ? join([
6676
        filterByQuery(term, fromHistoryMenuItems(history)),
6677
        filterByQuery(term, fromMenuItems('header')),
6678
        filterByQuery(term, anchorMenuItems())
6679
      ]) : filterByQuery(term, fromHistoryMenuItems(history));
6680
    };
6681
    var addToHistory = function (url, fileType) {
6682
      var items = history[fileType];
6683
      if (!/^https?/.test(url)) {