Repository: incubator-brooklyn Updated Branches: refs/heads/master 0c85cd90a -> 23b8fa02f
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a4a14f95/usage/jsgui/src/main/webapp/assets/js/libs/jquery.slideto.min.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/libs/jquery.slideto.min.js b/usage/jsgui/src/main/webapp/assets/js/libs/jquery.slideto.min.js deleted file mode 100644 index 105f532..0000000 --- a/usage/jsgui/src/main/webapp/assets/js/libs/jquery.slideto.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/** brooklyn note: - * from swagger, added in: - * https://github.com/wordnik/swagger-ui/commit/d2eb882e5262e135dfa3f5919796bbc3785880b8#diff-bd86720650a2ebd1ab11e870dc475564 - * apache 2.0 licensed - * (no non-minimized version available) - */ -(function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a4a14f95/usage/jsgui/src/main/webapp/assets/js/util/dataTables.extensions.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/util/dataTables.extensions.js b/usage/jsgui/src/main/webapp/assets/js/util/dataTables.extensions.js new file mode 100644 index 0000000..17dc782 --- /dev/null +++ b/usage/jsgui/src/main/webapp/assets/js/util/dataTables.extensions.js @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * + * Based on jQuery DataTables plug-ins for: + * * fnStandingRedraw by Jonathan Hoguet, + * http://www.datatables.net/plug-ins/api/fnStandingRedraw + * * fnProcessingIndicator by Allan Chappell + * https://www.datatables.net/plug-ins/api/fnProcessingIndicator + * + * Both rewritten for clarity and to preserve license integrity. + */ +define([ + "jquery", "jquery-datatables" +], function($, dataTables) { + +$.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) { + if (oSettings.oFeatures.bServerSide === false) { + // remember and restore cursor position + var oldDisplayStart = oSettings._iDisplayStart; + oSettings.oApi._fnReDraw(oSettings); + oSettings._iDisplayStart = oldDisplayStart; + oSettings.oApi._fnCalculateEnd(oSettings); + } + // and force draw + oSettings.oApi._fnDraw(oSettings); +}; + + +jQuery.fn.dataTableExt.oApi.fnProcessingIndicator = function(oSettings, bShow) { + if (typeof bShow === "undefined") bShow=true; + this.oApi._fnProcessingDisplay(oSettings, bShow); +}; + +}); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a4a14f95/usage/jsgui/src/main/webapp/assets/js/util/jquery.slideto.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/util/jquery.slideto.js b/usage/jsgui/src/main/webapp/assets/js/util/jquery.slideto.js new file mode 100644 index 0000000..4dd69a2 --- /dev/null +++ b/usage/jsgui/src/main/webapp/assets/js/util/jquery.slideto.js @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * + * Based on jquery.slideto.min.js in Swagger UI, added in: + * https://github.com/wordnik/swagger-ui/commit/d2eb882e5262e135dfa3f5919796bbc3785880b8#diff-bd86720650a2ebd1ab11e870dc475564 + * + * Swagger UI is distributed under ASL but it is not clear that this code originated in that project. + * No other original author could be identified. + * + * Nearly identical code is referenced here: + * http://stackoverflow.com/questions/12375440/scrolling-works-in-chrome-but-not-in-firefox-or-ie + * + * The project https://github.com/Sleavely/jQuery-slideto is NOT this. + * + * Rewritten for readability and to preserve license integrity. + */ +(function(jquery){ +jquery.fn.slideto=function(opts) { + opts = _.extend( { + highlight: true, + slide_duration: "slow", + highlight_duration: 3000, + highlight_color: "#FFFF99" }, + opts); + return this.each(function() { + $target=jquery(this); + jquery("body").animate( + { scrollTop: $target.offset().top }, + opts.slide_duration, + function() { + opts.highlight && + jquery.ui.version && + $target.effect( + "highlight", + { color: opts.highlight_color }, + opts.highlight_duration) + }) + }); +}}) (jQuery); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a4a14f95/usage/jsgui/src/test/javascript/config.txt ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/test/javascript/config.txt b/usage/jsgui/src/test/javascript/config.txt index f540274..0fec281 100644 --- a/usage/jsgui/src/test/javascript/config.txt +++ b/usage/jsgui/src/test/javascript/config.txt @@ -27,7 +27,7 @@ "bootstrap":"js/libs/bootstrap", "jquery-form":"js/libs/jquery.form", "jquery-datatables":"js/libs/jquery.dataTables", - "jquery-slideto":"js/libs/jquery.slideto.min", + "jquery-slideto":"js/util/jquery.slideto", "jquery-wiggle":"js/libs/jquery.wiggle.min", "jquery-ba-bbq":"js/libs/jquery.ba-bbq.min", "moment":"js/libs/moment", @@ -35,7 +35,7 @@ "brooklyn":"js/util/brooklyn", "brooklyn-view":"js/util/brooklyn-view", "brooklyn-utils":"js/util/brooklyn-utils", - "datatables-extensions":"js/libs/dataTables.extensions", + "datatables-extensions":"js/util/dataTables.extensions", "googlemaps":"view/googlemaps", // async deliberately excluded "text":"js/libs/text",
