2 * Copyright 2016-2017, CMCC Technologies Co., Ltd.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
16 var initMainPage = function() {
\r
18 var propertiesFilePath = "i18n/";
\r
19 var propertiesFileName = "web-framework-mainPage-i18n";
\r
20 var i18nName = "openo_main_page_i18n";
\r
25 url : "json/main_page.json",
\r
27 "success" : function (res, textStatus, jqXHR) {
\r
28 modules = res.modules;
\r
30 error : function () {
\r
34 var template = "<div class='brick {image}'>" +
\r
35 "<a id='{linkId}' href='{url}' class='entranceLink'>" +
\r
36 "<div class='row'>" +
\r
37 "<div class='cover contentToggle'>{cover}</div>" +
\r
38 "<div class='{toolsImage}'></div>" +
\r
39 "<div class='contentTip contentToggle'>{contentTip}</div>" +
\r
44 var templatePic = "<div class='brick {image}'>" +
\r
45 "<div class='row'>" +
\r
46 "<div class='cover contentToggle'>{cover}</div>" +
\r
47 "<div class='{toolsImage}'></div>" +
\r
48 "<div class='contentTip contentToggle'>{contentTip}</div>" +
\r
52 for (var i = 0; i < modules.length; ++i) {
\r
54 if (modules[i].linkId) {
\r
55 temp = template.replace("{linkId}", modules[i].linkId)
\r
56 .replace("{image}", modules[i].background)
\r
57 .replace("{toolsImage}", modules[i].toolsImage)
\r
58 .replace("{url}", modules[i].url)
\r
59 .replace("{contentTip}", modules[i].contentTip);
\r
61 temp = templatePic.replace("{image}", modules[i].background)
\r
62 .replace("{url}", modules[i].url)
\r
63 .replace("{contentTip}", "");
\r
66 if (modules[i].cover) {
\r
67 temp = temp.replace("{cover}", "<span id='" + modules[i].cover + "' name_i18n='openo_main_page_i18n'></span>");
\r
69 temp = temp.replace("{cover}","");
\r
72 $($(".column")[i % 4]).append(temp);
\r
76 $(".brick").mouseover(function() {
\r
77 $(".contentTip", this).fadeTo(1000, 1);
\r
78 $(".cover", this).fadeOut(1000);
\r
81 $(".brick").mouseout(function() {
\r
82 $(".contentTip", this).fadeTo(1000, 0);
\r
83 $(".cover", this).fadeIn(1000);
\r
86 $("a.entranceLink").click(function(e) {
\r
88 if ($(this).attr("id") && $(this).attr("id") != "undefined") {
\r
89 location.href = "default.html" + "#_" + $(this).attr("id");
\r
93 loadi18n_WebFramework(propertiesFileName, propertiesFilePath, i18nName);
\r