Commit f8165a011cd1aa448dd204784847b44db4913f9c
1 parent
d9a729cb
add MBrowser.js
Showing
2 changed files
with
42 additions
and
2 deletions
src/js/MBrowser.js
0 → 100644
| 1 | +cordova.define("com.gaoxiaobang.browser.MBrowserPlugin", function(require, exports, module) { | |
| 2 | +/** | |
| 3 | + * Created by Ryan on 16/2/24. | |
| 4 | + */ | |
| 5 | +var MBrowserPlugin = function(){}; | |
| 6 | + | |
| 7 | +var exec = require('cordova/exec'); | |
| 8 | + | |
| 9 | +MBrowserPlugin.prototype.browser = function(data,sucess,error){ | |
| 10 | + | |
| 11 | + exec(sucess,error,"MBrowserPlugin","browser",[data]); | |
| 12 | + | |
| 13 | +} | |
| 14 | + | |
| 15 | +MBrowserPlugin.prototype.goback = function(data,sucess,error){ | |
| 16 | + | |
| 17 | + alert("goback"); | |
| 18 | + | |
| 19 | + exec(sucess,error,"MBrowserPlugin","goback",[data]); | |
| 20 | + | |
| 21 | +} | |
| 22 | + | |
| 23 | + | |
| 24 | +if(!window.plugins){ | |
| 25 | + window.plugins = {}; | |
| 26 | +} | |
| 27 | + | |
| 28 | +if(!window.plugins.MBrowserPlugin){ | |
| 29 | + window.plugins.MBrowserPlugin = new MBrowserPlugin(); | |
| 30 | +} | |
| 31 | + | |
| 32 | +module.exports = new MBrowserPlugin(); | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | +}); | ... | ... |
src/player.html
| ... | ... | @@ -53,6 +53,7 @@ |
| 53 | 53 | <script src="js/gbreplayer.js"></script> |
| 54 | 54 | <script src="js/recording/recording.js"></script> |
| 55 | 55 | <script src="js/player1.js"></script> |
| 56 | + <script src="js/MBrowser.js"></script> | |
| 56 | 57 | |
| 57 | 58 | <style> |
| 58 | 59 | .title{ |
| ... | ... | @@ -382,12 +383,14 @@ |
| 382 | 383 | <script> |
| 383 | 384 | $(function(){ |
| 384 | 385 | $('.back').click(function(){ |
| 386 | + alert('plugins') | |
| 387 | + alert(plugins) | |
| 385 | 388 | var gobackData = {} |
| 386 | 389 | plugins.MSharePlugin.goback() |
| 387 | - console.log(plugins) | |
| 390 | + | |
| 388 | 391 | }) |
| 389 | 392 | $('.share').click(function(){ |
| 390 | - console.log(plugins) | |
| 393 | + alert(plugins) | |
| 391 | 394 | var title = getQuery('title'); |
| 392 | 395 | var shareData = { |
| 393 | 396 | title: title, | ... | ... |