--- /dev/null
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>MKWS demo jasmine test framework</title>
+ <link rel="stylesheet" type="text/css" href="../../tools/htdocs/mkws.css" />
+ <link rel="shortcut icon" type="image/png" href="../../../jasmine/lib/jasmine-1.3.1/jasmine_favicon.png">
+ <link rel="stylesheet" type="text/css" href="../../../jasmine/lib/jasmine-1.3.1/jasmine.css">
+ <style type="text/css">
+ #mkwsTermlists div.facet {
+ float:left;
+ width: 30%;
+ margin: 0.3em;
+ }
+ #mkwsStat {
+ text-align: right;
+ }
+ </style>
+ </head>
+
+ <body>
+ <table width="100%" border="0">
+ <tr>
+ <td>
+ <div id="mkwsSwitch"></div>
+ <div id="mkwsLang"></div>
+ <div id="mkwsSearch"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="height:500px; overflow: auto">
+ <div id="mkwsPager"></div>
+ <div id="mkwsNavi"></div>
+ <div id="mkwsRecords"></div>
+ <div id="mkwsTargets"></div>
+ <div id="mkwsRanking"></div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="height:300px; overflow: hidden">
+ <div id="mkwsTermlists"></div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mkwsStat"></div>
+ </td>
+ </tr>
+ </table>
+
+ <script type="text/javascript" src="../../tools/htdocs/mkws-complete.js"></script>
+
+ <!-- SECTION jasmine -->
+ <script type="text/javascript" src="../../../jasmine/lib/jasmine-1.3.1/jasmine.js"></script>
+ <script type="text/javascript" src="../../../jasmine/lib/jasmine-1.3.1/jasmine-html.js"></script>
+ <script type="text/javascript" src="../../test/spec/true.spec.js"></script>
+ <script type="text/javascript" src="../../test/spec/mkws-config.js"></script>
+ <script type="text/javascript" src="../../test/spec/mkws-pazpar2.js"></script>
+ <script type="text/javascript" src="../../test/js/mkws-jasmine-run.js"></script>
+ <script type="text/javascript"> $(document).ready(function() { mkws_jasmine_init(); }); </script>
+ <!-- SECTION jasmine -->
+
+ <script type="text/javascript">
+ var mkws_config = {
+ perpage_default: 10
+ };
+ </script>
+
+ </body>
+</html>
filters: []
};
-/*
- * global config object: mkws_config
- *
- * Needs to be defined in the HTML header before including this JS file.
- * Define empty mkws_config for simple applications that don't define it.
- */
+// Define empty mkws_config for simple applications that don't define it.
if (mkws_config == null || typeof mkws_config != 'object') {
var mkws_config = {};
}
-// Wrapper for jQuery
-(function ($) {
+// wrapper for jQuery lib
+function _mkws($) {
+ // if (console && console.log) console.log("run _mkws()");
+
+ // call this function only once
+ if (mkws.init) return;
mkws.locale_lang = {
"de": {
console.log(timestamp + string);
}
var debug = mkws.debug_function; // local alias
+debug("start running MKWS");
Handlebars.registerHelper('json', function(obj) {
}
}
-
+debug("Create main pz2 object");
// create a parameters array and pass it to the pz2's constructor
// then register the form submit event with the pz2.search function
// autoInit is set to true on default
}
+// implement $.parseQuerystring() for parsing URL parameters
+function parseQuerystring() {
+ var nvpair = {};
+ var qs = window.location.search.replace('?', '');
+ var pairs = qs.split('&');
+ $.each(pairs, function(i, v){
+ var pair = v.split('=');
+ nvpair[pair[0]] = pair[1];
+ });
+ return nvpair;
+}
+
function mkws_set_lang() {
- var lang = $.parseQuerystring().lang || mkws_config.lang;
+ var lang = parseQuerystring().lang || mkws_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
mkws_config.lang = ""
} else {
return mkws.locale_lang[lang][word] || word;
}
+// main
+(function() {
+ try {
+ mkws_html_all()
+ }
+
+ catch (e) {
+ mkws_config.error = e.message;
+ // alert(e.message);
+ }
+})();
+
+ // done
+ mkws.init = true;
+};
+
+
/*
- * implement jQuery plugins
+ * implement jQuery plugin $.pazpar2({})
*/
-$.extend({
- // implement $.parseQuerystring() for parsing URL parameters
- parseQuerystring: function() {
- var nvpair = {};
- var qs = window.location.search.replace('?', '');
- var pairs = qs.split('&');
- $.each(pairs, function(i, v){
- var pair = v.split('=');
- nvpair[pair[0]] = pair[1];
+function _mkws_jquery_plugin ($) {
+ // delayed debug, internal variables are set after dom ready
+ function debug (string) {
+ setTimeout(function() { mkws.debug_function(string); }, 500);
+ }
+
+ function init_popup(obj) {
+ var config = obj ? obj : {};
+
+ var height = config.height || 760;
+ var width = config.width || 880;
+ var id_button = config.id_button || "input#mkwsButton";
+ var id_popup = config.id_popup || "#mkwsPopup";
+
+ debug("popup height: " + height + ", width: " + width);
+
+ // make sure that jquery-ui was loaded afte jQuery core lib, e.g.:
+ // <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
+ if (!$.ui) {
+ debug("Error: jquery-ui.js is missing, did you included it after jquery core in the HTML file?");
+ return;
+ }
+
+ $(id_popup).dialog({
+ closeOnEscape: true,
+ autoOpen: false,
+ height: height,
+ width: width,
+ modal: true,
+ resizable: true,
+ buttons: {
+ Cancel: function() {
+ $(this).dialog("close");
+ }
+ },
+ close: function() { }
});
- return nvpair;
- },
- debug2: function(string) { // delayed debug, internal variables are set after dom ready
- setTimeout(function() { debug(string); }, 500);
- },
+ $(id_button)
+ .button()
+ .click(function() {
+ $(id_popup).dialog("open");
+ });
+ };
+
+ $.extend({
// service-proxy or pazpar2
pazpar2: function(config) {
</div>'
if (config && config.layout == 'div') {
- this.debug2("jquery plugin layout: div");
+ debug("jquery plugin layout: div");
document.write(div);
} else if (config && config.layout == 'popup') {
- this.debug2("jquery plugin layout: popup with id: " + id_popup);
+ debug("jquery plugin layout: popup with id: " + id_popup);
document.write(popup);
$(document).ready( function() { init_popup(config); } );
} else {
- this.debug2("jquery plugin layout: table");
+ debug("jquery plugin layout: table");
document.write(table);
}
}
});
-
-function init_popup(obj) {
- var config = obj ? obj : {};
-
- var height = config.height || 760;
- var width = config.width || 880;
- var id_button = config.id_button || "input#mkwsButton";
- var id_popup = config.id_popup || "#mkwsPopup";
-
- debug("popup height: " + height + ", width: " + width);
-
- // make sure that jquery-ui was loaded afte jQuery core lib, e.g.:
- // <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
- if (!$.ui) {
- debug("Error: jquery-ui.js is missing, did you included it after jquery core in the HTML file?");
- return;
- }
-
- $(id_popup).dialog({
- closeOnEscape: true,
- autoOpen: false,
- height: height,
- width: width,
- modal: true,
- resizable: true,
- buttons: {
- Cancel: function() {
- $(this).dialog("close");
- }
- },
- close: function() { }
- });
-
- $(id_button)
- .button()
- .click(function() {
- $(id_popup).dialog("open");
- });
};
+// wrapper to call _mkws after page load
+(function (j) {
+ // enable before page load, so we could call it before mkws() runs
+ _mkws_jquery_plugin(j);
-
-
-/* magic */
-$(document).ready(function() {
- try {
- mkws_html_all()
- }
-
- catch (e) {
- mkws_config.error = e.message;
- // alert(e.message);
- }
-});
-
+ $(document).ready(function() {
+ // if (console && console.log) console.log("on load ready");
+ _mkws(j);
+ });
})(jQuery);