我正在尝试实现嵌入。使用jquery,它嵌入数据的链接从一个url当我们共享复制到文本框(非常类似于如何facebook实现链接共享)
虽然这里给出的说明,看起来很简单,我缺乏javascript经验意味着我错过了一些重要的步骤,这样的javascript本身根本没有加载。
我已经把所有的文件放到了正确的位置。
指令http://www.embedify.me/Home/Documentation金桥
代码<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
<link href="/Content/EmbeddedReprUrl.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Scripts/swfobject.js"></script>
<script src="Scripts/EmbeddedReprUrl.Config-1.0.0.js" type="text/javascript"> </script>
<script src="Scripts/jquery.transform.js" type="text/javascript"></script>
<script src="Scripts/EmbeddedReprUrl-1.0.0.js" type="text/javascript"></script>
<script src="Scripts/EmbeddedRepresentationXsl-1.0.js" type="text/javascript"> </script>
<script src="Scripts/jwplayer.js" type="text/javascript"></script>
</head>
<body>
<textarea rows="2" cols="50" id="txt" class="embeddor">Enter a URL here </textarea>
<script language="javascript" type="text/javascript">
var embeddedReprUrl = new EmbeddedReprUrl();
var postHtml = embeddedReprUrl.GetFullContent($("txt"));
alert(postHtml);
</script>
</body>
</html>
在EmbeddedReprUrl-1.0.0.js文件中找到这个代码块:-
if (jQuery.browser.opera) {
$(selector).bind('input', function (e) {
var tempEditedElement = $(this); //this is needed for opera, it is forgetting $(this) after timeout
setTimeout(function () {
func(tempEditedElement);
}, 100);
});
} else {
$(selector).keyup(function (event) {
var embeddingTriggeringKeyCodes = new Array(8, 13, 32, 45, 46, 86, 88);
if ($.inArray(event.keyCode, embeddingTriggeringKeyCodes) > -1) {
func($(this));
}
});
$(selector).bind('cut paste delete drop', function (e) {
setTimeout(function () {
func($(this));
}, 100);
});
}
并替换为:-
$(selector).keyup(function (event) {
var embeddingTriggeringKeyCodes = new Array(8, 13, 32, 45, 46, 86, 88);
if ($.inArray(event.keyCode, embeddingTriggeringKeyCodes) > -1) {
func($(this));
}
});
$(selector).bind('cut paste delete drop', function (e) {
setTimeout(function () {
func($(this));
}, 100);
});