AppBar

  data.js



(function () {
    "use strict";

    function getItemReference(item) {
        return [item.group.key, item.title];
    }

    function resolveGroupReference(key) {
        for (var i = 0; i < groupedItems.groups.length; i++) {
            if (groupedItems.groups.getAt(i).key === key) {
                return groupedItems.groups.getAt(i);
            }
        }
    }

    function resolveItemReference(reference) {
        for (var i = 0; i < groupedItems.length; i++) {
            var item = groupedItems.getAt(i);
            if (item.group.key === reference[0] && item.title === reference[1]) {
                return item;
            }
        }
    }

    function getItemsFromGroup(group) {
        return list.createFiltered(function (item) { return item.group.key === group.key; });
    }

    var backImage1 = "https://lh4.googleusercontent.com/-hHZ3UeOrQGQ/T_J4kLkBN2I/AAAAAAAAHB0/D-MsMRu7j0g/s205/_naver.png";
    var backImage2 = "https://lh5.googleusercontent.com/-F7zC9HwtSTw/T_J4kIny9XI/AAAAAAAAHBw/AesYu2jQHbI/s224/_yahoo.png";

    var sampleGroups = null;
    var sampleItems = null;

    var list = new WinJS.Binding.List();
    var groupedItems = list.createGrouped(
        function groupKeySelector(item) { return item.group.key; },
        function groupDataSelector(item) { return item.group; }
    );

    var serverUrl = "http://matome.naver.jp/feed/hot";
    var xhr = new WinJS.xhr({
        type: "GET",
        url: serverUrl
    }).then(function (req) {

        Debug.writeln(req.responseXML);
        var root = req.responseXML;
        var items = root.getElementsByTagName("item");
        var thumbnail_img = null;

        for( var i = 0; i < items.length; i++ ) {

            var item = {};
            item.group = {};
            item.group.key = "naver"
            item.group.title = "NAVER"
            item.group.subtitle = "Windows8 ひな形拡張";
            item.group.backgroundImage = backImage1;
            item.group.description = "グループの説明";

            item.title = items[i].getElementsByTagName("title")[0].firstChild.nodeValue;
            item.subtitle = "作者 : " + items[i].getElementsByTagName("dc:creator")[0].firstChild.nodeValue;
            item.description = "";
            item.link = items[i].getElementsByTagName("link")[0].firstChild.nodeValue;

            try {
                item.content = items[i].getElementsByTagName("description")[0].firstChild.nodeValue + "<br /><a href=\"" + items[i].getElementsByTagName("link")[0].firstChild.nodeValue + "\">ブラウザリンク</a>";
            }
            catch (e) {
                item.content = "";
            }

            thumbnail_img = items[i].getElementsByTagName("media:thumbnail")[0].getAttribute("url");
            item.backgroundImage = thumbnail_img;

            list.push(item);
           
        }


    }, function (req) {
        Debug.writeln("正しく取得できませんでした");
    });


    var serverUrl = "http://rss.weather.yahoo.co.jp/rss/days/6200.xml";
    var xhr = new WinJS.xhr({
        type: "GET",
        url: serverUrl
    }).then(function (req) {

        Debug.writeln(req.responseXML);
        var root = req.responseXML;
        var items = root.getElementsByTagName("item");
        var thumbnail_img = null;

        for (var i = 0; i < items.length; i++) {

            var item = {};
            item.group = {};
            item.group.key = "yahoo"
            item.group.title = "Yahoo! 天気"
            item.group.subtitle = "Windows8 ひな形拡張";
            item.group.backgroundImage = backImage2;
            item.group.description = "グループの説明";

            item.title = items[i].getElementsByTagName("title")[0].firstChild.nodeValue;
            item.subtitle = "";
            item.description = items[i].getElementsByTagName("link")[0].firstChild.nodeValue;

            try {
                item.content = items[i].getElementsByTagName("description")[0].firstChild.nodeValue;
            }
            catch (e) {
                item.content = "";
            }

            thumbnail_img = "https://lh3.googleusercontent.com/-byjvNpDs538/TwbSVn_202I/AAAAAAAAE2g/gbeMVoj4SPU/s200/b17nauke014.jpg";
            item.backgroundImage = thumbnail_img;

            list.push(item);

        }


    }, function (req) {
        Debug.writeln("正しく取得できませんでした");
    });

    function newPage() {
        Debug.writeln("newPage:" + WinJS.Navigation.location);
        if (WinJS.Navigation.location != "/pages/hello/hello.html") {
            WinJS.Navigation.navigate(
                '/pages/hello/hello.html',
                {
                    param1: '自動的に',
                    param2: 'ページのオプションとして ready イベントへ'
                }
            );
        }
        document.getElementById("appbar").winControl.hide();

    }

    WinJS.Namespace.define("Data", {
        items: groupedItems,
        newPage: newPage,
        groups: groupedItems.groups,
        getItemsFromGroup: getItemsFromGroup,
        getItemReference: getItemReference,
        resolveGroupReference: resolveGroupReference,
        resolveItemReference: resolveItemReference
    });
})();




  split.html



<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <title>splitPage</title>

    <!-- WinJS references -->
    <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
    <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
    
    <link href="/css/default.css" rel="stylesheet" />
    <link href="/pages/split/split.css" rel="stylesheet" />
    <script src="/js/data.js"></script>
    <script src="/pages/split/split.js"></script>
</head>
<body>
    <!-- This template is used to display each item in the ListView declared below. -->
    <div class="itemtemplate" data-win-control="WinJS.Binding.Template">
        <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" />
        <div class="item-info">
            <h3 class="item-title win-type-ellipsis" data-win-bind="textContent: title"></h3>
            <h6 class="item-subtitle win-type-ellipsis" data-win-bind="textContent: subtitle"></h6>
            <h4 class="item-description" data-win-bind="textContent: description"></h4>
        </div>
    </div>

    <!-- The content that will be loaded and displayed. -->
    <div class="splitpage fragment">
        <header aria-label="Header content" role="banner">
            <button class="win-backbutton" aria-label="Back" disabled></button>
            <h1 class="titlearea win-type-ellipsis">
                <span class="pagetitle"></span>
            </h1>
        </header>
        <div class="itemlistsection" aria-label="List column">
            <div class="itemlist" aria-label="List of this group's items" data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'single', tapBehavior: 'toggleSelect' }"></div>
        </div>
        <div class="articlesection" aria-atomic="true" aria-label="Item detail column" aria-live="assertive">
            <article>
                <header class="header">
                    <div class="text">
                        <h2 class="article-title win-type-ellipsis" data-win-bind="textContent: title"></h2>
                        <h4 class="article-subtitle" data-win-bind="textContent: subtitle"></h4>
                    </div>
                    <img class="article-image" src="#" data-win-bind="src: backgroundImage; alt: title" />
                </header>
                <div class="article-content" data-win-bind="innerHTML: content"></div>
                <a class="article-link" data-win-bind="href: link" style="cursor:pointer">ブラウザリンク</a>
                <br />
                <iframe class="article-iframe" data-win-bind="src: link" style="width:100%;height:400px"></iframe>
            </article>
        </div>
    </div>
</body>
</html>




  hello.html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <title>splitPage</title>

    <!-- WinJS references -->
    <link rel="stylesheet" type="text/css" href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" />
    <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
    
    <link href="/css/default.css" rel="stylesheet" />
    <link href="/pages/split/split.css" rel="stylesheet" />
    <script type="text/javascript" src="hello.js"></script>
</head>
<body>

    <div style="padding:20px;">
    <header aria-label="Header content" role="banner">
        <button class="win-backbutton" aria-label="Back" disabled></button>
    </header>
        こんにちは

    </div>
    

</body>
</html>



  hello.js

(function () {
    "use strict";

    var appViewState = Windows.UI.ViewManagement.ApplicationViewState;
    var binding = WinJS.Binding;
    var nav = WinJS.Navigation;
    var ui = WinJS.UI;
    var utils = WinJS.Utilities;

    ui.Pages.define("/pages/hello/hello.html", {

        // この関数は、ユーザーがこのページに移動するたびに呼び出されます。
        // ページ要素にアプリケーションのデータを設定します。
        ready: function (element, options) {
            Debug.writeln(JSON.stringify(options, null, "   "));
        },
        unload: function () {

        }
    });
})();











  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ