Updated application sources
[apps/web/sample/FileManager.git] / project / js / app.ui.templateManager.modifiers.js
1 /*
2  *      Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  *      Licensed under the Flora License, Version 1.1 (the "License");
5  *      you may not use this file except in compliance with the License.
6  *      You may obtain a copy of the License at
7  *
8  *              http://floralicense.org/license/
9  *
10  *      Unless required by applicable law or agreed to in writing, software
11  *      distributed under the License is distributed on an "AS IS" BASIS,
12  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *      See the License for the specific language governing permissions and
14  *      limitations under the License.
15  */
16
17 /*global $*/
18 /**
19  * @class ModifierManager
20  */
21 function ModifierManager() {
22     'use strict';
23     this.init();
24 }
25
26 (function () {
27     'use strict';
28     ModifierManager.prototype = {
29
30         /**
31          * UI module initialisation
32          */
33         init: function () {
34         },
35
36         /**
37          * @return modifiers object
38          */
39         getAll: function () {
40             return this.modifiers;
41         },
42
43         /**
44          * modifiers definitions
45          */
46         modifiers: {
47             escape: function escape(str) {
48                 return $('<span>').text(str).html();
49             },
50             escapeEncies: function escapeEncies(str) {
51                 var tagsToReplace = {
52                     '&': '&amp;',
53                     '<': '&lt;',
54                     '>': '&gt;',
55                     '"': '&quot;'
56                 };
57                 return str.replace(/[&<>\"]/g, function (tag) {
58                     return tagsToReplace[tag] || tag;
59                 });
60             }
61         }
62     };
63 }());