Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for using of external jquery #6

Open
alexbodn opened this issue Nov 5, 2016 · 0 comments
Open

fix for using of external jquery #6

alexbodn opened this issue Nov 5, 2016 · 0 comments

Comments

@alexbodn
Copy link

alexbodn commented Nov 5, 2016

hello friends,

i made a couple fixes to allow usage of jquery from google apis,
even versions not supplied with the widget.

diff --git a/tw2/jquery/base.py b/tw2/jquery/base.py
index 69bf8b4..535ebb3 100644
--- a/tw2/jquery/base.py
+++ b/tw2/jquery/base.py
@@ -54,3 +54,4 @@ class jQueryPluginCSSLink(jQueryPluginLinkMixin, CSSLink):
 
 jquery_js = jQueryJSLink()
 jQuery = js_function('jQuery')
+
diff --git a/tw2/jquery/version.py b/tw2/jquery/version.py
index 83334c5..6f291d4 100644
--- a/tw2/jquery/version.py
+++ b/tw2/jquery/version.py
@@ -81,8 +81,9 @@ class JSLinkMixin(Link):
                     'static',
                     self.dirname,
                     self.core_filename
-                ))).replace('//', '/')
-            self._link = link
+                )))
+            self._link = '://'.join([
+                part.replace('//', '/')  for part in link.split('://')])
         return self._link % self.substitutions
 
     def _set_link(self, link):
@@ -97,6 +98,8 @@ class JSLinkMixin(Link):
         ))
 
     def try_filename(self, filename):
+        if self.is_external:
+            return filename
         abspath = self.abspath(filename)
         if os.path.exists(abspath):
             return filename

please patch and enjoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant