`, попытавшись
20 | автоматически определить язык. Когда автоопределение не срабатывает, можно явно
21 | указать язык в атрибуте class:
22 |
23 | ```html
24 |
...
25 | ```
26 |
27 | Список поддерживаемых классов языков доступен в [справочнике по классам][8].
28 | Класс также можно предваоить префиксами `language-` или `lang-`.
29 |
30 | Чтобы отключить подсветку для какого-то блока, используйте класс `nohighlight`:
31 |
32 | ```html
33 |
...
34 | ```
35 |
36 | ## Инициализация вручную
37 |
38 | Чтобы иметь чуть больше контроля за инициализацией подсветки, вы можете
39 | использовать функции [`highlightBlock`][2] и [`configure`][3]. Таким образом
40 | можно управлять тем, *что* подсвечивать и *когда*.
41 |
42 | Вот пример инициализация, эквивалентной вызову [`initHighlightingOnLoad`][1], но
43 | с использованием jQuery:
44 |
45 | ```javascript
46 | $(document).ready(function() {
47 | $('pre code').each(function(i, block) {
48 | hljs.highlightBlock(block);
49 | });
50 | });
51 | ```
52 |
53 | Вы можете использовать любые теги разметки вместо `
`. Если
54 | используете контейнер, не сохраняющий переводы строк, вам нужно сказать
55 | highlight.js использовать для них тег ` `:
56 |
57 | ```javascript
58 | hljs.configure({useBR: true});
59 |
60 | $('div.code').each(function(i, block) {
61 | hljs.highlightBlock(block);
62 | });
63 | ```
64 |
65 | Другие опции можно найти в документации функции [`configure`][3].
66 |
67 |
68 | ## Установка библиотеки
69 |
70 | Highlight.js можно использовать в браузере прямо с CDN хостинга или скачать
71 | индивидуальную сборку, а также установив модуль на сервере. На
72 | [страница загрузки][4] подробно описаны все варианты.
73 |
74 | Обратите внимание, что библиотека не предназначена для использования в виде
75 | исходного кода на GitHub, а требует отдельной сборки. Если вам не подходит ни
76 | один из готовых вариантов, читайте [документацию по сборке][5].
77 |
78 |
79 | ## Лицензия
80 |
81 | Highlight.js распространяется под лицензией BSD. Подробнее читайте файл
82 | [LICENSE][10].
83 |
84 |
85 | ## Ссылки
86 |
87 | Официальный сайт билиотеки расположен по адресу .
88 |
89 | Более подробная документация по API и другим темам расположена на
90 | .
91 |
92 | Авторы и контрибьютора перечислена в файле [AUTHORS.ru.txt][9] file.
93 |
94 | [1]: http://highlightjs.readthedocs.org/en/latest/api.html#inithighlightingonload
95 | [2]: http://highlightjs.readthedocs.org/en/latest/api.html#highlightblock-block
96 | [3]: http://highlightjs.readthedocs.org/en/latest/api.html#configure-options
97 | [4]: https://highlightjs.org/download/
98 | [5]: http://highlightjs.readthedocs.org/en/latest/building-testing.html
99 | [8]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
100 | [9]: https://github.com/isagalaev/highlight.js/blob/master/AUTHORS.ru.txt
101 | [10]: https://github.com/isagalaev/highlight.js/blob/master/LICENSE
102 |
--------------------------------------------------------------------------------
/common/highlight/README.md:
--------------------------------------------------------------------------------
1 | # Highlight.js
2 |
3 | [](https://travis-ci.org/isagalaev/highlight.js)
4 |
5 | Highlight.js is a syntax highlighter written in JavaScript. It works in the
6 | browser as well as on the server. It works with pretty much any markup,
7 | doesn’t depend on any framework and has automatic language detection.
8 |
9 |
10 | ## Getting Started
11 |
12 | The bare minimum for using highlight.js on a web page is linking to the library
13 | along with one of the styles and calling [`initHighlightingOnLoad`][1]:
14 |
15 | ```html
16 |
17 |
18 |
19 | ```
20 |
21 | This will find and highlight code inside of `
` tags; it tries to detect
22 | the language automatically. If automatic detection doesn’t work for you, you can
23 | specify the language in the `class` attribute:
24 |
25 | ```html
26 |
...
27 | ```
28 |
29 | The list of supported language classes is available in the [class reference][8].
30 | Classes can also be prefixed with either `language-` or `lang-`.
31 |
32 | To disable highlighting altogether use the `nohighlight` class:
33 |
34 | ```html
35 |
...
36 | ```
37 |
38 | ## Custom Initialization
39 |
40 | When you need a bit more control over the initialization of
41 | highlight.js, you can use the [`highlightBlock`][2] and [`configure`][3]
42 | functions. This allows you to control *what* to highlight and *when*.
43 |
44 | Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using jQuery:
45 |
46 | ```javascript
47 | $(document).ready(function() {
48 | $('pre code').each(function(i, block) {
49 | hljs.highlightBlock(block);
50 | });
51 | });
52 | ```
53 |
54 | You can use any tags instead of `
` to mark up your code. If you don't
55 | use a container that preserve line breaks you will need to configure
56 | highlight.js to use the ` ` tag:
57 |
58 | ```javascript
59 | hljs.configure({useBR: true});
60 |
61 | $('div.code').each(function(i, block) {
62 | hljs.highlightBlock(block);
63 | });
64 | ```
65 |
66 | For other options refer to the documentation for [`configure`][3].
67 |
68 |
69 | ## Getting the Library
70 |
71 | You can get highlight.js as a hosted or custom-build browser script or as a
72 | server module. Head over to the [download page][4] for all the options.
73 |
74 | **Note:** the library is not supposed to work straight from the source on
75 | GitHub; it requires building. If none of the pre-packaged options work for you
76 | refer to the [building documentation][5].
77 |
78 |
79 | ## License
80 |
81 | Highlight.js is released under the BSD License. See [LICENSE][10] file for
82 | details.
83 |
84 |
85 | ## Links
86 |
87 | The official site for the library is at .
88 |
89 | Further in-depth documentation for the API and other topics is at
90 | .
91 |
92 | Authors and contributors are listed in the [AUTHORS.en.txt][9] file.
93 |
94 | [1]: http://highlightjs.readthedocs.org/en/latest/api.html#inithighlightingonload
95 | [2]: http://highlightjs.readthedocs.org/en/latest/api.html#highlightblock-block
96 | [3]: http://highlightjs.readthedocs.org/en/latest/api.html#configure-options
97 | [4]: https://highlightjs.org/download/
98 | [5]: http://highlightjs.readthedocs.org/en/latest/building-testing.html
99 | [8]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
100 | [9]: https://github.com/isagalaev/highlight.js/blob/master/AUTHORS.en.txt
101 | [10]: https://github.com/isagalaev/highlight.js/blob/master/LICENSE
102 |
--------------------------------------------------------------------------------
/conformance-tests/datachannel_test/helpfunctions.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Peter Titz
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 | * SUCH DAMAGE.
25 | */
26 | /**
27 | * Returns current System Time: HH:MM:SS,ms
28 | */
29 | function getCurrentTime() {
30 | var now = new Date();
31 | var hour = now.getHours();
32 | var min = now.getMinutes();
33 | var sec = now.getSeconds();
34 | var ms = now.getMilliseconds();
35 | if (hour < 10) {
36 | hour = "0" + hour;
37 | }
38 | if (min < 10) {
39 | min = "0" + min;
40 | }
41 | if (sec < 10) {
42 | sec = "0" + sec;
43 | }
44 | return hour + ":" + min + ":" + sec+","+ms;
45 | }
46 |
47 | /**
48 | * Returns a string
49 | * @param {Object} size: returns a string: 2^size Byte (= letters)
50 | */
51 | function generateData(size) {
52 | var s = "-";
53 | for (var i = 0; i < size; i++) {
54 | s += s;
55 | }
56 | return s;
57 | }
58 |
59 | /**
60 | * Retruns a String
61 | * @param {Object} size: returns a string with length size
62 | */
63 | function generateLinearData(size) {
64 | var s = "";
65 | for (var i = 0; i < size; i++) {
66 | s += "s";
67 | }
68 | return s;
69 | }
70 |
71 | function generateLinearDataChar(character, length) {
72 | var string = "";
73 | for(var i=0; i < length; i++) {
74 | string += character;
75 | }
76 |
77 | return string;
78 | }
79 |
80 | /**
81 | * Returns the Byte count from a string
82 | * @param {Object} str
83 | */
84 | function byteCount(str) {
85 | return encodeURI(str).split(/%..|./).length - 1;
86 | }
87 |
88 | /**
89 | * Check for available readyStates in a String, returns the Objekt
90 | * @param {Object} str
91 | */
92 | function checkForReadyStates(str){
93 | var check = new Array();
94 | var values = ["connecting", "open", "closing", "closed"];
95 | var returnValue = { missed: false,message: ""};
96 | for(var i = 0; i< values.length; i++){
97 | if(str.search(values[i]) == -1){
98 | returnValue.message += " '" +values[i]+"'";
99 | returnValue.missed = true;
100 | }
101 | }
102 | if(returnValue.missed == true)
103 | returnValue.message = "Missed readyState" + returnValue.message;
104 | return returnValue;
105 | }
106 |
107 | function getBrowserInformation() {
108 | if(window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.RTCPeerConnection){
109 | $('#browserInformation').addClass('alert-success');
110 | } else {
111 | $('#browserInformation').addClass('alert-danger');
112 | }
113 | $('#browserInformation').append(navigator.userAgent);
114 | }
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/signaling/signaling.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | WebRTC Data Channel Playground - Signaling Demo
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
68 |
69 |
70 |
Signaling Demo
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
Create peer ID ...
80 |
83 |
84 |
85 |
86 |
87 |
88 |
... or connect to peer
89 |
90 |
91 |
92 |
93 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | chat
120 |
121 |
122 |
123 |
124 |
125 |
126 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/conformance-tests/datachannel_test/dctest_init.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Peter Titz
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 | * SUCH DAMAGE.
25 | */
26 |
27 | /**
28 | * This testsuite runs with datachannellocal.js and datachannellocal_switcher.js
29 | * Testframework: testharness W3C http://testthewebforward.org/docs/
30 | * Testing the webRTC DataChannel API: http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-data-api
31 | *
32 | * To mimic a DataChannel connection between two peers the sript creates two different RTCPeerConnections in one Browser
33 | * Peer A = localPeerConnection, localChannel
34 | * Peer B = remotePeerConnection, remoteChannel
35 | */
36 |
37 | var showResults = false;
38 | var testResult = ["Pass", "Fail", "Timeout"];
39 | var testCounter = 0;
40 | // Stores all test names
41 | var testNames ="";
42 | // Stores all test results
43 | var testResults = "";
44 | // Stores complete information
45 | var testCompleteResults = "
";
76 |
77 |
78 | logWrite("Test: " + (res.name) + "... done! - \"" + availableTestList[testCounter] + "\"");
79 | if (showResults)
80 | console.log("Result received", res);
81 |
82 | //If only runs one test don't close the channels to test with the console
83 | if(availableTestList.length != 1)
84 | {
85 | // Close the channels and set to null
86 | closeRTCPeerConnection();
87 | }
88 |
89 | // If test completed start the next test after short break
90 | setTimeout(function(){
91 | testSwitcher(testCounter);
92 | }, 500);
93 | }
94 |
95 | // Testharness completion callback from all tests.
96 | function completion_callback(allRes, status) {
97 | $('#progressbar').css('width', '100%').attr('aria-valuenow', 100).html(testCounter+' tests completed!').removeClass('active').removeClass('progress-bar-striped');
98 |
99 | logWrite("Tests completed!");
100 | testCompleteResults += "
";
101 | console.log("Test results: ", allRes, status);
102 | }
103 |
104 |
105 | /**
106 | * Test whether prefixes are used
107 | */
108 | function testDCPC() {
109 | test(function() {
110 | assert_true(!!testRTCPeerConnection, "RTCPeerConnection not available, musst use prefix");
111 | }, "testDCPC: Check if RTCPeerConnection is available");
112 | }
113 |
114 | function testDCPCMoz() {
115 | test(function() {
116 | assert_true(!!window.mozRTCPeerConnection, "You don't use Firefox or a too old version");
117 | }, "testDCPCMoz: Check if mozRTCPeerConnection (Firefox) is available");
118 | }
119 |
120 | function testDCPCWebkit() {
121 | test(function() {
122 | assert_true(!!window.webkitRTCPeerConnection, "You don't use Google/Opera or a too old version");
123 | }, "testDCPCWebkit: Check if webkitRTCPeerConnection (Google/Opera) is available");
124 | }
125 |
--------------------------------------------------------------------------------
/gyrocolor/gyrocolor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | WebRTC Data Channel Playground - Gyrocolor
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
68 |
69 |
70 |
Gyrocolor
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
Create peer ID ...
80 |
83 |
84 |
85 |
86 |
87 |
88 |
... or connect to peer
89 |
90 |
91 |
92 |
93 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
Gyro Data:
118 |
119 |
120 |
121 |
type
122 |
alpha
123 |
beta
124 |
gamma
125 |
126 |
127 |
128 |
129 |
nothing yet
130 |
131 |
132 |
nothing yet
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/conformance-tests/datachannel_test/dctest_switcher.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Peter Titz
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 | * SUCH DAMAGE.
25 | */
26 |
27 | /**
28 | * This file takes care of the test excecution
29 | */
30 |
31 | var availableTestList = [];
32 | var selectedTestList = [];
33 |
34 |
35 | // Run the next test
36 | function testSwitcher(count) {
37 | if (count < selectedTestList.length) {
38 | try {
39 | eval(selectedTestList[count] + "()");
40 | } catch(err) {
41 | console.log("Error while eval function " + selectedTestList[count], err);
42 | }
43 | } else {
44 | done();
45 | }
46 | }
47 |
48 | // Check for all functions are available in space with name testDC - all dataChannel tests
49 | function getMethods(obj) {
50 | var tests = [];
51 | for (var m in obj) {
52 | if ( typeof obj[m] === "function") {
53 | if (m.search("testDC") != -1) {
54 | tests.push(m);
55 | }
56 | }
57 | }
58 | $('#badgeTestcount').html(tests.length);
59 | availableTestList = tests;
60 | }
61 |
62 | // Create the table with all available tests
63 | function fillTestList() {
64 | var testlistHTML = "